Solved

PowerPoint 2007 events

Posted on 2011-09-03
3
384 Views
Last Modified: 2012-06-22
I have added an ActiveX webbrowser control to a slide.  I'd like it to navigate to a local file as soon as the presentation starts, but I am having trouble figuring out how to use events to trigger action.

This has been my reference:
http://msdn.microsoft.com/en-us/library/bb265913(v=office.12).aspx

I cannot figure out how to auto-run the InitializeApp sub.

From the msdn link:
To create an event handler for an event of the Application object, you need to complete the following three steps:
1.Declare an object variable in a class module to respond to the events.
2.Write the specific event procedures.
3.Initialize the declared object from another module(this is the InitializeApp sub below)


To create an event handler for an event of the Application object, you need to complete the following three steps:
1.Declare an object variable in a class module to respond to the events.
2.Write the specific event procedures.
3.Initialize the declared object from another module.

Declare the Object Variable

Before you can write procedures for the events of the Application object, you must create a new class module and declare an object of type Application with events. For example, assume that a new class module is created and called EventClassModule. The new class module contains the following code.
 


Public WithEvents App As Application 

Write the Event Procedures

After the new object is declared with events, it appears in the Object list in the class module, and you can write event procedures for the new object. (When you select the new object in the Object list, the valid events for that object are listed in the Procedure list.) Select an event from the Procedure list; an empty procedure is added to the class module.
 


Private Sub App_NewPresentation()

End Sub 

Initializing the Declared Object

Before the procedure will run, you must connect the declared object in the class module (App in this example) with the Application object. You can do this with the following code from any module.
 


Dim X As New EventClassModule
Sub InitializeApp()
    Set X.App = Application
End Sub 

Run the InitializeApp procedure. After the procedure is run, the App object in the class module points to the Microsoft Office PowerPoint Application object, and the event procedures in the class module will run when the events occur.

Open in new window

0
Comment
Question by:motokent
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 59

Accepted Solution

by:
Chris Bottomley earned 250 total points
ID: 36479502
Unfortunately, PPT is not fully compatible with htis and to do as you want requires an add-in.   Via an add-in you can detect events, one of which is initialise on open.

See http://skp.mvps.org/autoevents.htm for an appropriate add-in and guide.

Chris
0
 
LVL 23

Assisted Solution

by:JSRWilson
JSRWilson earned 250 total points
ID: 36480019
In 2007 and 2010 you can auto run the initializeApp sub by using the onLoad of the ribbon when the presentation is loaded. Not entirely reliable though.

See http://www.pptalchemy.co.uk/PowerPoint_Auto_Open_Code.html for more

0
 

Author Closing Comment

by:motokent
ID: 36480199
Thanks both of you.
0

Featured Post

Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to import an Outlook PST file to Office 365 using a third party product to avoid Microsoft's Azure command line tool, saving you time.
Outlook for dependable use in a very small business   This article is about using the Outlook application (part of Microsoft Office) in a very small business, or for homeowners where dependability and reliability are critical requirements. This …
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question