VBA Coding in PowerPoint

C

Chaplain Doug

PowerPoint 2002. I am new to coding in PowerPoint. I have done a bit of
coding in Access. I know how to create a command button on a PP slide. I
know hoe to put code behind the button. What commands would I use to display
another slide and then close the slide when I click on a command button?
Something like?
DoCmd.Open slide
kp = msgbox "test",vbOKOnly,"test"
if kp=vbOK then DoCmd.close slide
 
D

David M. Marcovitz

As Steve said, you can do this without VBA, but if you want to use VBA...

Keep in mind that PowerPoint doesn't generally keep multiple slides open
when you are in Slide Show View. That means that if you go to a slide, the
slide you came from is automatically closed. You can use a simple command
like:

ActivePresentation.SlideShowWindow.View.Next

to go to the next slide, or

ActivePresentation.SlideShowWindow.View.GotoSlide 3

to go to the 3rd slide.

You could do something more complicated like:

Sub GoTo3WithConfirm()
theButton = MsgBox("Do you really want to go to slide 3?", vbYesNo)
If theButton = vbYes Then
ActivePresentation.SlideShowWindow.View.GotoSlide 3
End If
End Sub

This procedure will ask you if you are really sure you want to go to slide
3. If you click yes, it will go. If you click no, it won't. I think that
is what you asked for in your example.

--David

David M. Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 

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