Solved

To close powerpoint window through vb.net

Posted on 2010-11-19
6
1,603 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 500 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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
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

Technology Partners: 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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
BgInfo help 5 65
Delete Temp on all PCs 7 52
C# Windows Form Navigation - Total Beginner 9 48
UPS Worldship 2017 on Windows 2008 R2 - (ET) 9 17
Learn how to PXE Boot both BIOS & UEFI machines with DHCP Policies and Custom Vendor Classes
No single Antivirus application (despite claims by manufacturers) will catch or protect you from all Virus / Malware or Spyware threats. That doesn't stop you from further protecting yourself however - and this article is to show you how.
Viewers will learn how to include realistic velocity sensitivity to their Sampler instruments. Set the Vol<Vel parameter in the Filter/Global tab to your desired setting: Gather samples of hits of various intensity, and drag/drop into Velocity zon…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

733 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