Monday, May 14, 2012 6:45 PM
Is it possible to create a PowerPoint Presentation that does the following:
- starts out by displaying a slide show of pictures with background music
- segues into a slide show with a videoclip on the screen of a group playing music and the rest of the screen displays the slides?
please contact me at email@example.com
Tuesday, May 15, 2012 9:30 AMModerator
Here’s the suggestion:
As the first part of this issue, I think it can be done with the AfterPresentationOpen event.
In this event, write the code to do what you want.
But before that, we should create an event handler. We can declare a variable of the object's class using the WithEvents keyword. "WithEvents" keyword is used to create an object variable that responds to events that are activated by an ActiveX object.
Steps to create the handler:
1.Open a new presentation.
2.Launch VBE (Alt+F11). Insert a new class into the project
3.Type the line given below:
Public WithEvents PPTEvent As Application
The WithEvents keyword specifies that the variable PPTEvent will be used to handle an object's (application) events.
4.Now click on the Object combo box. The Object Variable PPTEvent will be listed there. Select PPTEvent. In the adjoining Procedure combo box select from one of the choices of events listed and add appropriate code to the events that you wish to handle.
5.Now insert a new module sheet. cEventClass is the name of the class . Hence add the following line:
Dim cPPTObject As New cEventClass
This is done because we need to instantiate an object of the cEventClass and then set the reference of the object variable PPTEvent to the PowerPoint application. The reference is set in the TrapEvents routine by the line given below:
Set cPPTObject.PPTEvent = Application
In the EventHandler Demo, look up the routine TrapEvents for this statement. Execute it. This will activate the eventhandler 1.To terminate the eventhandler set the refernce of the object variable to Nothing (just like any other object variable) like this:
Set cPPTObject.PPTEvent = Nothing
In the file this statement will be encountered in the ReleaseEvent routine.
•An Event handler cannot be set automatically. To set an event handler when PowerPoint starts up you still need to rely on the Auto_Open macro of an add-in to instantiate the event handler.
•An event handler is disabled as soon as the presentation/add-in in which it resides is closed/unloaded.
TechNet Community Support
- Marked As Answer by Jaynet ZhangMicrosoft Contingent Staff, Moderator Monday, May 21, 2012 2:09 AM