Solved

To close powerpoint window through vb.net

Posted on 2010-11-19
6
1,513 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
Comment Utility
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 500 total points
Comment Utility
A quick look see suggests for example the following example:

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

Chris
0
 

Author Comment

by:gopalhazel
Comment Utility
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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 59

Expert Comment

by:Chris Bottomley
Comment Utility
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
Comment Utility
oPP.Quit I would have thought would work too.

Is this 2010 or an earlier version
0
 

Author Comment

by:gopalhazel
Comment Utility
this is for Ms2003 and MS2007
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
Great sound, comfort and fit, excellent build quality, versatility, compatibility. These are just some of the many reasons for choosing a headset from Sennheiser.
Viewers will learn how to create and use Simpler instruments in Ableton Live. Load new Simpler into an empty MIDI track: Select a sample and drop it into sample window in Simpler: If sample is not pitched at C3, adjust tuning with Transpose para…
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now