Paul
Try this
Sub RunSlides()
Dim ppApp As PowerPoint.Application
Dim ppPres As PowerPoint.Presentation
Set ppApp = New PowerPoint.Application
ppApp.Visible = True
Set ppPres = ppApp.Presentations.Open("C:\Dick\ng\11Nov\SlideSh ow.pps")
'Loop until the last slide is the one shown
Do
DoEvents
Loop Until ppApp.SlideShowWindows(1).View.CurrentShowPosition =
ppPres.Slides.Count
Application.Wait Now + TimeValue("00:00:02") 'wait 2 seconds
ppApp.Quit
'do other stuff
End Sub
There's probably some ways to improve this. For instance, checking
ppPres.Slides.Count may not give the right result if you're using a Custom
Show. I don't know enough about PowerPoint to comment on that. Also, the
two second wait could probably be made to find the timing of the last slide
instead of two seconds. It should get you started though.
--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com
"Paul" wrote in message
...
Hello All
I have a macro in Excel starting PowerPoint, running a slideshow, then
shutting down PowerPoint. It's working OK except I'm currently shutting
down
PowerPoint based on time. What I would really like to do is detect when
the
slideshow is over and end PowerPoint that way. I've done lots of searching
but I just can't seem to find the code I'm looking for.
Any assistance would be much appreciated,
Paul
my code
Sub SlideShow()
Dim ppApp As PowerPoint.Application
Set ppApp = CreateObject("Powerpoint.Application")
ppApp.Visible = True
Dim ppPres As PowerPoint.Presentation
Set ppPres = ppApp.Presentations.Open("C:\SlideShow.pps")
Sleep (15000)
ppApp.Quit
Application.Run "ReturntoExcel"
End Sub