[VBA] - Running presentation through code

A

AlexT

Folks,

Probably a trivial question...

I have a presentation that runs just fine when started using the
interactive menu (F5).

However when using VBA it gets "stuck" to the first slide...

Here is my code:

PowerPoint.Presentations.Open locFile
With ActivePresentation.SlideShowSettings
.LoopUntilStopped = msoTrue
.ShowType = ppShowTypeKiosk
.Run
End With
What's wrong ?

Additionally, I'd like to hide the windows cursor (which incidentally
does not show up when running the very same presentation
interactively). How world I do that ?

Any info / pointer welcome

Thanks

--alexT
 
S

Steve Rindsberg

AlexT said:
Folks,

Probably a trivial question...

I have a presentation that runs just fine when started using the
interactive menu (F5).

However when using VBA it gets "stuck" to the first slide...

Here is my code:

PowerPoint.Presentations.Open locFile
With ActivePresentation.SlideShowSettings
.LoopUntilStopped = msoTrue
.ShowType = ppShowTypeKiosk
.Run
End With
What's wrong ?


1) Is focus on the VBA IDE rather than on the PowerPoint slide/show window when
you run the code? The show won't advance until its window has focus. Try
minimizing the IDE.

2) Are your slide advances set to Automatically After x seconds in addition to
(or instead of) On mouse click? If not, the show won't advance.
 
S

Shyam Pillai

Alex,
In addition to Steve's comments, you've set the show to run in kiosk mode.
Is this intentional? Kiosk mode prevents the show from progressing via mouse
clicks. You need to provide buttons on the slide to navigate thru the
slideshow.
 
A

AlexT

Steve,

Thanks for your message
1) Is focus on the VBA IDE rather than on the PowerPoint slide/show
window when you run the code? The show won't advance until its
window has focus. Try minimizing the IDE.

Actually my code is runing from a PowerPoint add-in
2) Are your slide advances set to Automatically After x seconds in
addition to (or instead of) On mouse click? If not, the show won't
advance.

Yes, that's the case
In addition to Steve's comments, you've set the show to run in kiosk
mode. Is this intentional? Kiosk mode prevents the show from
progressing via mouse clicks. You need to provide buttons on the slide
to navigate thru the slideshow.

Actually the presentation is supposed to run unattended, looping
endlessly without user interaction...

--alexT
 
S

Steve Rindsberg

1) Is focus on the VBA IDE rather than on the PowerPoint slide/show
Actually my code is runing from a PowerPoint add-in

So the IDE isn't even open at the time. [SFX: a great theory going down in
flames]
Yes, that's the case


Actually the presentation is supposed to run unattended, looping
endlessly without user interaction...

That *should* work, so long as there's an automatic transition on each slide.
At least it does here when I invoked a test presentation using your code.

Try this: insert a new slide as slide one; make sure it includes nothing but
a title and of course that it's set to autoadvance.

Does the show now hang on this new slide or does it move to (now) slide 2 and
hang there?
 
A

AlexT

Folks,

Thanks for all the help and ideas

Actually I have managed to pinpoint my problem to the fact that after
opening my presentation I still continue to run VBA.

My goal is to have a file watcher that scans through a folder a
whenever a presentation is added it does close the current presentation
and open that new file.

Everything works as fine except that the new presentation will not
"run" as long as VBA is running.

I have tried to run a DoEvent loop, as well as a calling the Kernel
sleep function.

Evidently PowerPoint doesn't multi thread it's presentations...

So I guess my best bet is to have an external trigger that would raise
an event in PP. No sure it's doable in VBA... Any suggestion ?

Regards

--alexT
 
S

Steve Rindsberg

AlexT said:
Folks,

Thanks for all the help and ideas

Actually I have managed to pinpoint my problem to the fact that after
opening my presentation I still continue to run VBA.

My goal is to have a file watcher that scans through a folder a
whenever a presentation is added it does close the current presentation
and open that new file.

Everything works as fine except that the new presentation will not
"run" as long as VBA is running.

I have tried to run a DoEvent loop, as well as a calling the Kernel
sleep function.

Evidently PowerPoint doesn't multi thread it's presentations...

So I guess my best bet is to have an external trigger that would raise
an event in PP. No sure it's doable in VBA... Any suggestion ?

Have a look here:

Make PPT respond to events
http://www.rdpslides.com/pptfaq/FAQ00004.htm

And before following up, it'd be good to compose a more detailed description of
what you're doing and include some sample code. You hadn't mentioned any of
this about add'l presentations until now. A bit confusing ...
 

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