Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

To close powerpoint window through vb.net

Posted on 2010-11-19
6
Medium Priority
?
1,717 Views
Last Modified: 2013-12-16
I am not getting how to close powerpoint window  or application through vb.net

code sample for the same is,

  Dim oPP As Microsoft.Office.Interop.PowerPoint.ApplicationClass
                            Dim oPresSet As Microsoft.Office.Interop.PowerPoint.Presentations
                            Dim oPres As Microsoft.Office.Interop.PowerPoint.PresentationClass


                            Try
                                oPP = GetObject(, "PowerPoint.Application")
                            Catch ex As Exception
                                oPP = New Microsoft.Office.Interop.PowerPoint.Application
                            End Try

                            oPP.Visible = True
                            oPresSet = oPP.Presentations
                            oPres = oPresSet.Open((SrceFileName), , , True)
                            oPP.ActivePresentation.SaveAs(_destname, 1, )
                            oPP.ActivePresentation.Close()
                            oPP.Quit()

but it does not get closed.....
0
Comment
Question by:gopalhazel
  • 3
  • 2
6 Comments
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 34171525
Have you tried releasing the object:

Chris
Dim oPP As Microsoft.Office.Interop.PowerPoint.ApplicationClass
                            Dim oPresSet As Microsoft.Office.Interop.PowerPoint.Presentations
                            Dim oPres As Microsoft.Office.Interop.PowerPoint.PresentationClass


                            Try
                                oPP = GetObject(, "PowerPoint.Application")
                            Catch ex As Exception
                                oPP = New Microsoft.Office.Interop.PowerPoint.Application
                            End Try

                            oPP.Visible = True
                            oPresSet = oPP.Presentations
                            oPres = oPresSet.Open((SrceFileName), , , True)
                            oPP.ActivePresentation.SaveAs(_destname, 1, )
                            oPP.ActivePresentation.Close()
                            oPP.Quit()
system.runtime.interopservices.marshal.releasecomobject (opp)
opp = nothing

Open in new window

0
 
LVL 59

Accepted Solution

by:
Chris Bottomley earned 2000 total points
ID: 34171540
A quick look see suggests for example the following example:

http://support.microsoft.com/kb/306682

Chris
0
 

Author Comment

by:gopalhazel
ID: 34172161
Hi Chris,

I tried that but it didn't work. It closes all the active presentations but powerpoint remains open in minimized state.
in word, i have done as

 newword_.Documents.Application.ActiveWindow.View.FullScreen = False
                newword_.Quit()

it closes winword from taskbar. similarly what we can do for powerpoint??
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 34172411
Honestly can't help then ... I expected release object on the app and presentation would have done it.

Chris
0
 
LVL 23

Expert Comment

by:JSRWilson
ID: 34173808
oPP.Quit I would have thought would work too.

Is this 2010 or an earlier version
0
 

Author Comment

by:gopalhazel
ID: 34179238
this is for Ms2003 and MS2007
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When asking a question in a forum or creating documentation, screenshots are vital tools that can convey a lot more information and save you and your reader a lot of time
This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
Viewers will learn the basics of creating custom device Racks in Ableton Live. Place instrument(s) and effects onto a track, and select them all by holding the Shift key and clicking on the device title bars: Group them by typing Command-G (Ctrl-G…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question