VBA Coding in PowerPoint

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
Chaplain Doug said:
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

You don't need any VBA to do this. Draw an action button (or really, anything)
on a slide. Rightclick it and set its action settings to Hyperlink to: PPT file
and choose a file with your other slide in it.

On that slide, create another similar button but set its action setting to End
Show.

Since no vba is involved, this will work in the free Viewer as well as in PPT
itself.
 
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/
 
Back
Top