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

ID: Q165080

The information in this article applies to:

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 work 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/refguide/default.asp

Step 1. Inserting a Media Object

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

1. On the Insert menu, click Object.

2. Click to select the Create From File option.

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, using 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. Create the action button using the following steps:

   a. On the Drawing toolbar, click AutoShapes, point to Action
      Buttons, and then click the Action Button: Custom (blank)
      button.

   b. 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. If PowerPoint Help is not installed on your computer, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q120802
   TITLE     : Office: How to Add/Remove a Single Office
               Program or Component

REFERENCES

For more information about getting help with Visual Basic for Applications, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q163435
   TITLE     : VBA: Programming Resources for Visual Basic for
               Applications

Additional query words: 97 8.00 kbmacro kbpptvba ppt8 vba vbe ppt97
Keywords          : kbcode kbmacro kbprg kbdta kbdtacode kbpptvba 
Version           : WINDOWS:97
Platform          : WINDOWS
Hardware          : x86
Issue type        : kbhowto

Last Reviewed: May 17, 1999