PPT2000: Sample Macro for Generic Previous Slide Transition with Animations (261178)



The information in this article applies to:

  • Microsoft PowerPoint 2000

This article was previously published under Q261178

SUMMARY

The sample code in this article creates a single action button on the master slide of the presentation, which allows you to go backward through your presentation, restarting the animations on the previously viewed slides.

MORE INFORMATION

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. NOTE: The following macro examples work only in PowerPoint. Visual Basic for Applications macros are not supported by the Microsoft PowerPoint Viewer. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

Code Sample

Sub GoPrevSlide()
    Dim lSlide As Long

' Get the current slide position in the slide show.
'    
    lSlide = SlideShowWindows(1).View.CurrentShowPosition

' If the current position is slide 1 of the presentation,
' then set lSlide to the last slide position. Alternately,
' you could set lSlide to 2, which prevents it from 
' "wrapping" or "looping" in reverse. Setting it to 2 
' causes it to stay in place. Or, you can subsititute the
' the following line of code in place of the current Then
' statement:
'
'        SlideShowWindows(1).View.Exit
'
' This ends the show if you try to go past slide 1
' backward.
'    
    If lSlide = 1 Then
        lSlide = ActivePresentation.Slides.Count
    
    Else:

' Set lSlide to the index position previous to the
' current slide.

        lSlide = lSlide - 1
        
    End If

' Go to the slide indicated by lSlide and start the
' animations on that slide.
'    
    SlideShowWindows(1).View.GotoSlide lSlide, msoTrue
End Sub
				

Adding and Configuring an Action Button to the Slide Master

  1. On the View menu, point to Master, and then click Slide Master.
  2. To create an action button, follow these steps:
    1. On the Drawing toolbar, click AutoShapes, point to Action Buttons, and then click the Action Button: Custom button.
    2. Draw the action button on the master slide.
  3. In the Action Settings dialog box, click the Mouse Click tab.
  4. Click Run macro.
  5. In the list of macros, click the GoPrevSlide macro.
  6. Click OK.
  7. On the View, click Normal to return to the slide view.

REFERENCES

For more information about action buttons, click Microsoft PowerPoint Help on the Help menu, type about action buttons in a presentation in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

Modification Type:MinorLast Reviewed:10/11/2006
Keywords:kbdtacode kbhowto KB261178