Solved

To close powerpoint window through vb.net

Posted on 2010-11-19
6
1,630 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
Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

 
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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

A lot of things can happen during a presentation, worst of which is “death by PowerPoint.” Here are a few mistakes to avoid to make your slides clean.
I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
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…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

691 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