Problems with automation of PPT 97

M

Mike M.

I have a VB 6 program that automates PowerPoint to start/end a slide show.
I am trying to get the code to work with PPT 97 as well as 2000 and 2002.
The code works fine on 2000 and 2002 using msppt8.olb, msppt9.olb and
msppt.olb. However, when I run the program on a machine with PPT 97
installed I have two problems:
1. The PPT User Interface (frame window) shows.
2. The close of the pres and quit of the PPT application don't cause it to
go away. PowerPnt.exe is still listed in the task manager. The User
Interface went away though.

Here is the code snipped from my test program (some of you might recognize
parts of it <g>):

Dim ppt As PowerPoint.Application
Dim oPresA As PowerPoint.Presentation

' PowerPoint Constants
Const ppShowTypeSpeaker = 1
Const ppShowTypeInWindow = 1000

Set ppt = New PowerPoint.Application
If Not ppt Is Nothing Then
Set oPresA = ppt.Presentations.Open(App.Path & "\test.pps", , ,
msoFalse)
If Not oPresA Is Nothing Then
With oPresA
With .SlideShowSettings
.ShowType = ppShowTypeSpeaker
.Run
End With
' Try to size the slide show to fit in frame.
.SlideShowWindow.Height = Frame1.Height / 20
.SlideShowWindow.Width = Frame1.Width / 20
pptHandle = FindWindow("screenClass", vbNullString)
SetParent pptHandle, Frame1.hwnd
End With
End If
End If

In the form close I do this:

Frame1.Caption = "Please wait while shutting down show..."
If (Not oPresA Is Nothing) Then
oPresA.Close
Set oPresA = Nothing
End If
ppt.Quit
Set ppt = Nothing

I expected this to work the same as it does with PPT 2000. Am I wrong in
Assuming this?

TIA

"Judge not the lowly worm lest ye be judged accordingly"
 
M

Mike M.

After further testing with PowerPoint 97 I have observed (but don't
understand) the following:
The aPres.Close has does not close the slideshow. The ppt.Quit causes the
PowerPoint User Interface to go away but the slide show is still visible and
POWERPNT.EXE is still running in task manager.

If I hit escape with the slide show in focus the slide show goes away and
when I close my form/program everything goes away and PowerPoint exits
correctly.
There aren't any other methods for a presentation to "stop" a slide show so
I don't know what the difference is between the escape and programmatically
calling .Close. The code works fine on PPT 2000, 2002.

Any thoughts?
 
M

Mike M.

YOU had a childhood?! or two or three....

Thanks Steve. I am glad that nugget dropped out of retirment. That is
zactly what's happening. I wonder if I can trick it into decrementing it's
reference counter. Maybe if I put the call to .Close and .Quit in a loop
for say 1000 iterations. Maybe I'll just force a reboot of the system.
That'll get it. <g>
 

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