Archive | Power Point (Office Automation) RSS for this section

Free Books from Microsoft Press

1 – Programming Windows Phone 7

Programming Windows Phone 7 by Charles Petzold

This book is divided into three parts. The first part discusses basic concepts of Windows Phone 7 programming using example programs that target both Silverlight and the XNA framework. It is likely that many Windows Phone 7 developers will choose either one platform or the other, but I think it’s important for all developers who have at least a little knowledge of the alternative to their chosen path.

The second part of this book focuses entirely on Silverlight, and the third part on XNA 2D. For your convenience, the chapters in each part build upon previous knowledge in a progressive tutorial narrative, and hence are intended to be read sequentially.

2 – Moving to Microsoft Visual Studio 2010

Moving to Microsoft Visual Studio 2010

Moving to Microsoft Visual Studio 2010 was written with three audiences in mind: Part I is for developers moving from Visual Studio 2003 to Visual Studio 2010, Part II is for developers moving from Visual Studio 2005 and Part III is for developers moving from Visual Studio 2008.

Here’s a little bit about the authors: Ken Haines is a software development engineer at Microsoft, working in the Consumer and Online Division. He has a passion for distributed applications in the cloud and strives to help customers and partners find the right solution for their needs.

3 – Introducing Microsoft SQL Server 2008 R2

Introducing Microsoft SQL Server 2008 R2

This book is for anyone who has an interest in SQL Server 2008 R2 and wants to understand its capabilities. In a book of this size, we cannot cover every feature that distinguishes SQL Server from other databases, and consequently we assume that you have some familiarity with SQL Server already.

You might be a database administrator (DBA), an application developer, a power user, or a technical decision maker. Regardless of your role, we hope that you can use this book to discover the features in SQL Server 2008 R2 that are most beneficial to you.

4 – Understanding Microsoft Virtualization Solutions

Understanding Microsoft Virtualization Solutions

If you want to learn more about latest Microsoft virtualisation technologies, so that you can differentiate your Hyper-V from your Remote Desktop Services, then this’s the job.

It covers Microsoft Virtual Desktop Infrastructure, Application Virtualization 4.5, Enterprise Desktop Virtualization, Windows Virtual PC and Windows XP Mode, System Center Virtual Machine Manager 2008, and Microsoft’s private and public cloud computing platforms including Windows Azure.

5 – Own Your Future: Update Your Skills with Resources and Career Ideas from Microsoft

Own Your Future Update Your Skills with Resources and Career Ideas from Microsoft

In this book, students will find a wealth of Microsoft resources they can use to identify the technology skills they need, and gather knowledge and experience to help them take charge of their careers.

Here at Microsoft, we care about students’ career success and hope these resources will open doors to learning that will lead them to better opportunities and a deeper understanding of the way technology continues to change and improve the ways people work—both here in the U.S. and around the world.

6 – Introducing Windows Server 2008 R2

Introducing Windows Server 2008 R2

This book is targeted primarily at Windows server administrators who are responsible for hands-on deployment and day-to-day management of Windows-based servers for large organizations. Windows server administrators manage file and print servers, network infrastructure servers, Web servers, and IT application servers.

They use graphical administration tools as their primary interface but also use Windows PowerShell commandlets and occasionally write Windows PowerShell scripts for routine tasks and bulk operations. They conduct most server management tasks remotely by using Terminal Server or administration tools installed on their local workstation.

7 – First Look Microsoft Office 2010

First Look Microsoft Office 2010

This book introduces you to the changes in Office 2010 and shows you how you can make the most of the new features to fit the way you work today. Chapter 1, “Welcome to Office 2010,” gives you a play-by-play introduction to new features.

Chapter 2, “Express Yourself Effectively and Efficiently,” details the great feature enhancements and visual effects throughout the applications; and Chapter 3, “Work Anywhere with Office 2010,” explores the flexibility factor by presenting a set of scenarios that enable users to complete their work no matter where their path takes them and so on.

8 – Deploying Windows 7, Essential Guidance

Deploying Windows 7

Deploying Windows 7 Essential Guidance from the Windows 7 Resource Kit and Microsoft TechNet Magazine. Looking for guidance specific to Windows 7 deployment?

Check out what the industry’s leading experts have to say in this free Microsoft Press eBook with selected chapters from the Windows 7 Resource Kit on Deployment Platforms, Planning, Testing Application Compatability, and 8 Common Issues in Windows 7 Migrations

Source :


Hide Power Point Application Window in .NET (Office Automation)

Now a days I am working on some Windows Presentation Foundation (WPF) applications with Office Automation. I have created application where it was opening Microsoft Power Point files(I am using Microsoft Office 2007 version, i.e., *.pptx) and adding some data into it (Text, Pictures, Charts, etc.). That’s it!! Pretty simple ha!!!

Not exactly!! The biggest problem I was facing is when I am opening Power Point and adding data into it, it was splashing the screen also. The Power Point application was getting open and anyone can see it. It’s ok, not a big problem, but at the time when I have more than 100 slides!!!! It was not OK to let user see this opening and closing series of Power Point application.

So, what we do exactly when we get caught into something like this!! Aah!! Google 🙂

I went to Google and typed Hide Power Point Application Window in .NET (Office Automation).

You may go ahead and check the above link, where I have surfed almost 4 hours and couldn’t find anything. Any single thing that will help me to achieve my goal. 😦 😦 😦

What to do now!!!! I am one of the person who believe in “Nothing Is Impossible” 😀

Ok, enough of theory ha?? Let’s Jump Then, I have the solution with me right now and I’m sharing it with you 🙂

First In Short,

You will have to write your code like below,

objPPT = New PowerPoint.Application

objPPT.Visible = MsoTriState.msoFalse
Catch ex As Exception

End Try

You can’t write objPPT.Visible = MsoTriState.msoFalse alone without Try & Catch, because it will throw an error saying : Invalid request. Hiding the application window is not allowed.

So when you write it with Try & Catch block, it will work fine.

If it’s still giving some other error than the next step would be to write code as below,


That’s it.

Ok, now let’s see it into deep through the real code.

I have a demo application ready for you.

Steps :

1. Open Visual Studio 2010.

2. File -> New Project (VB.NET)

3. Go to Form1.vb (Source Code View)

4. Paste the below code as it is:

Imports Microsoft.Office.Interop
Imports Microsoft.Office.Interop.PowerPoint
Imports Microsoft.Office.Core

Public Class Form1
Dim objPPT As PowerPoint.Application
Dim objPres As PowerPoint.Presentation

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim objShape As PowerPoint.Shape
Dim strText As String = "This Has Been Created By : Naimish Pandya"
EnsurePowerPointIsRunning(True, True)

objShape = objPres.Slides(1).Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationHorizontal, 50, 300, 300, 300)
objShape.TextFrame.AutoSize = PowerPoint.PpAutoSize.ppAutoSizeShapeToFitText
objShape.TextFrame.TextRange.Text = strText
objShape.TextEffect.FontSize = 20
objShape.TextEffect.FontBold = MsoTriState.msoTrue
'Clean up
objShape = Nothing
Button2.Enabled = True

End Sub

Sub StartPowerPoint()
objPPT = New PowerPoint.Application
objPPT.Visible = MsoTriState.msoFalse
Catch ex As Exception

End Try
End Sub
Sub EnsurePowerPointIsRunning(Optional ByVal blnAddPresentation As Boolean = False, Optional ByVal blnAddSlide As Boolean = False)
Dim strName As String
'Try accessing the name property. If it causes an exception then
'start a new instance of PowerPoint
strName = objPPT.Name
Catch ex As Exception
End Try
'blnAddPresentation is used to ensure there is a presentation loaded
If blnAddPresentation = True Then
strName = objPres.Name
Catch ex As Exception
objPres = objPPT.Presentations.Add(MsoTriState.msoTrue)
End Try
End If
'BlnAddSlide is used to ensure there is at least one slide in the
If blnAddSlide Then
strName = objPres.Slides(1).Name
Catch ex As Exception
Dim objSlide As PowerPoint.Slide
Dim objCustomLayout As PowerPoint.CustomLayout
objCustomLayout = objPres.SlideMaster.CustomLayouts.Item(1)
objSlide = objPres.Slides.AddSlide(1, objCustomLayout)
objSlide.Layout = PowerPoint.PpSlideLayout.ppLayoutText
objCustomLayout = Nothing
objSlide = Nothing
End Try
End If
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Button2.Enabled = False
End Sub
End Class

Now run the application :

Hide Power Point Window

Hide Power Point Window

Try it out yourself and please let me know in case anything is not correct 😉

%d bloggers like this: