Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

PowerPoint 2007 events

Posted on 2011-09-03
3
Medium Priority
?
385 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 1000 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 1000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Cancel future meetings from user mailboxes in Office 365 using Remove-CalendarEvents
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

722 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