Microsoft KB Archive/222720

From BetaArchive Wiki

Article ID: 222720

Article Last Modified on 10/11/2006



APPLIES TO

  • Microsoft PowerPoint 2000 Standard Edition



This article was previously published under Q222720


SUMMARY

This article describes how to create an action button that activates a media object from within a slide show. The action button is assigned to a macro that controls when the media object is started.

NOTE: You can customize the macro in order to make the code function within your presentation.

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:

Step 1. Inserting a Media Object

To insert a media object on a slide, follow these steps:

  1. On the Insert menu, click Object.
  2. Click to select the Create From File.
  3. Click Browse.
  4. Locate and select the media object you want to use, and then click OK.
  5. Click OK.

NOTE: If you are using a movie media object and you select the Link option, the media player controls are displayed while the movie plays. To hide the media player controls, follow these steps:

  1. Select the movie.
  2. On the Edit menu, point to Media Clip Object, and then click Edit.


The object appears in Media Player.

  1. On the Edit menu, click Options.
  2. Click to clear all options except Play In Client Document, and then click OK.
  3. Click anywhere on the slide to cancel the selection of the media object.

The media player controls will not be visible when you activate the media object during the slide show.

Step 2. Configuring the Media Object

Set the media object play setting to Don't Play. To do this, follow these steps:

  1. Select the media object.
  2. On the Slide Show menu, click Custom Animation, and then click the Play Settings tab.
  3. From the Object Action list, select Don't Play, and then click OK.

Step 3. Creating the Macro Code

  1. On the Tools menu, point to Macro, and then click Visual Basic Editor.
  2. On the Insert menu, click Module.
  3. Type the following code into the module.

    NOTE: A line that is preceded by an apostrophe (') introduces a comment in the code. Comments are provided to explain what the code does at a particular point in the procedure. This text is optional and you may exclude it from your code.

         Sub StartMediaObject()
    
             ' Change this number to represent the slide number on which
             ' you placed the media object.
             Const SLIDE_NUM As Long = 1
    
             ' Add the number that has been assigned to your media object.
             ' Use the following steps to obtain the number:
             '   1. Right-click the media object, click Custom Animation,
             '      and then click the Timing tab.
             '   2. Identify the media object in the Slide Objects Without
             '      Animation list (the object is selected) and note the
             '      name given to the object. The name resembles "Object
             '      1" or "Object 8."
             '   3. Use the number of the object from step 2 in the macro
             '      code. For example, if your media object is listed as
             '      "Object 4," change the ShapeNum constant to the
             '      following:
             '      Const SHAPE_NUM As Long = 4
    
             Const SHAPE_NUM As Long = 1
    
             With ActivePresentation.Slides(SLIDE_NUM).Shapes(SHAPE_NUM)
                .AnimationSettings.AdvanceTime = 0
                .AnimationSettings.PlaySettings.PlayOnEntry = msoTrue
                .AnimationSettings.PlaySettings.ActionVerb = "Play"
             End With
    
             ' Refresh the slide. This forces the new object settings to
             ' take effect and the media object plays.
             SlideShowWindows(1).View.GotoSlide SLIDE_NUM, msoFalse
    
          End Sub
                            

Step 4. Adding and Configuring the Action Button

  1. To create the action button, follow these steps:
    1. On the Drawing toolbar, click AutoShapes, point to Action Buttons, and then click the Action Button: Custom (blank) button.
    2. Draw the action button on the slide.
  2. In the Action Settings dialog box, click the Mouse Click tab.
  3. Click to select the Run Macro option.
  4. From the list of macros, select the StartMediaObject macro.
  5. Click OK.

For more information about action buttons click the Office Assistant, type Interactive Presentations, click Search, and then click to view About creating interactive presentations.

NOTE: If the Assistant is hidden, click the Office Assistant button on the Standard toolbar.

REFERENCES

For more information about how to use the sample code in this article, click the article number below to view the article in the Microsoft Knowledge Base:

212536 OFF2000: How to Run Sample Code from Knowledge Base Articles



Additional query words: 9.00 ppt9 vba vbe ppt2k powerpt vba2k ppt9.0 ppt2000 program programming

Keywords: kbcode kbdtacode kbhowto kbmacro kbprogramming KB222720