VBS For 2002 versus 2003

B

BoomerM3

The following script (adaped from a MS example runs fine in PowerPoint
2002 but fails in 2003 (error noted in code comment). Two questions:
1. Can anyone help me get this to work in 2003?
2. Is it possible to modify this script so it will work in all versions
(or most versions)?

Thanks
peter

Const ppAdvanceOnTime = 2
Const ppShowTypeKiosk = 3
Const ppSlideShowDone = 5

Set objPPT = CreateObject("PowerPoint.Application")
objPPT.Visible = True

Set objPresentation = objPPT.Presentations.Open("d:\down\Nothing.pps")

objPresentation.Slides.Range.SlideShowTransition.AdvanceTime = 2
objPresentation.Slides.Range.SlideShowTransition.AdvanceOnTime = TRUE

objPresentation.SlideShowSettings.AdvanceMode = ppAdvanceOnTime
objPresentation.SlideShowSettings.ShowType = ppShowTypeKiosk
objPresentation.SlideShowSettings.StartingSlide = 1
objPresentation.SlideShowSettings.EndingSlide = _
objPresentation.Slides.Count

Set objSlideShow = objPresentation.SlideShowSettings.Run.View

'*** The "State" object not recognized in 2003 and PowerPoint
'*** wants to save changes in 2003 - not 2002
Do Until objSlideShow.State = ppSlideShowDone
Loop

'added to quit PPT
objPresentation.Close
objPPT.Quit
 
B

Bill Dilworth

Why not change :
Do Until objSlideShow.State = ppSlideShowDone
Loop

While SlideShowWindows.Count > 0
do events
loop

Haven't tested it, but it should do the trick for you.


--
Bill Dilworth
A proud member of the Microsoft PPT MVP Team
Users helping fellow users.
http://billdilworth.mvps.org
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
yahoo2@ Please read the PowerPoint FAQ pages.
yahoo. They answer most of our questions.
com www.pptfaq.com
..
 
B

Bill Dilworth

so ....

add 'objPresentation.' in front of the SlideShowWindows.Count

you may also want to toss a DoEvents into the checking loop.

Bill
 
B

BoomerM3

Now errors with:
"Object doesn't support this property or method:
objPresentation.SlideshowWindows"

BTW, neither Do....Loop nor DoEvents are allowable syntax in VBS.


peter
 
B

Bill Dilworth

You correctly provided the VBS in the subject line and I read VBA, my
apologies. I tend not to write in script, so will bow out at this point in
favor of someone that does write in VBS.

the microsoft.public.scripting.vbscript newgroup may also be able to lend a
hand.


--
Bill Dilworth
A proud member of the Microsoft PPT MVP Team
Users helping fellow users.
http://billdilworth.mvps.org
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
yahoo2@ Please read the PowerPoint FAQ pages.
yahoo. They answer most of our questions.
com www.pptfaq.com
..
 
B

BoomerM3

Steve,

I still get the error: State = ppSlideShowDone doesn't support this
property. While VBS doesn't support DoEvents, I have put large delays
in the loop. At some point, the error pops up.

Is there another way to check for the completion of a show? Thanks for
your help!!

peter
 

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