PPT2000: How to Activate a Media Object From a Macro Button

ID: Q222720


The information in this article applies to:
  • Microsoft PowerPoint 2000


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, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft Support professionals 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 needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

http://www.microsoft.com/support/supportnet/overview/overview.asp
NOTE: The following macro examples only work from within the PowerPoint application. Visual Basic for Applications macros are not supported by the Microsoft PowerPoint Viewer. For additional information, please see the following article in the Microsoft Knowledge Base:
Q230746 PPT: Viewer: Presentation Macros Don't Run

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.


  3. On the Edit menu, click Options.


  4. Click to clear all options except Play In Client Document, and then click OK.


  5. 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 using the sample code in this article, please see the following article in the Microsoft Knowledge Base:

Q212536 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 kbmacro kbprg kbdta kbdtacode kbVBp kbpptvba
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbhowto


Last Reviewed: July 14, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.