Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Edinburgh, Midlothian, Scotland
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Automatically running a macro/VBA on slide view (PP97)

    Apologies for the cross post - but I've had no luck in the Powerpoint forum.

    ************************
    Hi folks,

    Anyone know how to run a macro automatically when an individual slide opens during a Powerpoint Show - i.e. VBA command?

    Can do this with click'able hyperlink obviously, but can it be done automatically?

    Thanks in advance,

    Ade

  2. #2
    dave_hill
    Guest

    Re: Automatically running a macro/VBA on slide view (PP97)

    PowerPoint97 doesn't expose its slide events. About the closest thing I could find is this, taken from MS Automation KB Help file.
    Running a PowerPoint Macro

    This example demonstrates how to run a Microsoft PowerPoint macro using Automation. In order for this example to work, you must first create a PowerPoint presentation with a Visual Basic procedure. Follow these steps to do this:


    1. Start Microsoft PowerPoint and create a new, blank presentation with any layout.
    2. On the Tools menu, click Macro, and then Visual Basic Editor.
    3. In the Visual Basic Editor, click Module on the Insert menu.
    4. Add the following code to the new module:

    Option Explicit

    Sub PowerPointMacro()
    MsgBox "This is a PowerPoint Macro!"
    End Sub

    5. Close the Visual Basic editor and return to Microsoft PowerPoint.
    6. Save the PowerPoint presentation as "C:My DocumentspptMacro.ppt"
    7. Execute the following Visual Basic for Applications procedure in another Microsoft Visual Basic
    for Applications client application such as Microsoft Access or Microsoft Excel.

    Sub RunPowerPointMacro()
    Dim pptApp As PowerPoint.Application
    Dim pptPres As PowerPoint.Presentation
    Set pptApp = CreateObject("PowerPoint.Application")
    pptApp.Visible = msoTrue
    Set pptPres = _
    pptApp.Presentations.Open("C:My Documentspptmacro.ppt")
    pptApp.Run pptPres.Name & "!Module1.PowerPointMacro"
    End Sub

    Hope it helps -

  3. #3
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Edinburgh, Midlothian, Scotland
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automatically running a macro/VBA on slide view (PP97)

    Thanks for that Dave - a definitive answer to my question (PP not exposing slide events).

    The Automation info will be useful for other projects.

    Thanks again,

    Ade

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •