Getting PowerPoint to Quit

K

Kris Rockwell

Hello,

I'm not sure if this is the right forum to post to on the subject, but I
thought it may be worth a shot.

I am writing an application in C# that will open PowerPoint, save an
presentation as HTML and then quit. For the most part everything works very
well. However, the PPT application will not quit. The code is listed below
(apologies for readability).

PowerPoint.ApplicationClass oPP = new PowerPoint.ApplicationClass();
oPP.Visible = Microsoft.Office.Core.MsoTriState.msoTrue;
PowerPoint.Presentations oPresSet = oPP.Presentations;
PowerPoint._Presentation oPres =
oPresSet.Open(sFullPath,Microsoft.Office.Core.MsoTriState.msoFalse,Microso.O
ffice.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoTrue);

oPres.SaveAs(sTargetDir+"\\"+sSaveAs,
PowerPoint.PpSaveAsFileType.ppSaveAsHTML,Microsoft.Office.Core.MsoTriState.m
soFalse);

oPres.Close();

oPP.Quit();

oPres = null;
oPP = null;
oPresSet = null;


During a Google search I found that the same problem was occurring for folks
developing an automated process for Excel 2003, but the problem seemed to
disappear with Excel 2000. That leads me to believe that there is something
in PPT 2003 (or Office 2003) that may prevent the application from quitting.

Anyone have any ideas about this?

Thanks,
Kris
 
M

Mike M.

In C++ I do the following:
PowerPoint::_ApplicationPtr m_pPowerPoint;

m_pPowerPoint.Release();
 
M

Mike M.

Also, I have a note in my code that prior to PowerPoint 2002 there seemed to
be a problem with the reference counting in the PowerPoint object model
interface and PowerPoint would not close. What version are you using?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top