Presentation is loading. Please wait.

Presentation is loading. Please wait.

Ribbon-Activated PowerPoint Events Free VBA code from.

Similar presentations


Presentation on theme: "Ribbon-Activated PowerPoint Events Free VBA code from."— Presentation transcript:

1 Ribbon-Activated PowerPoint Events Free VBA code from

2 Background & Purpose Certain code in VBA requires initialisation, such as application events. The app initialisation is often triggered by the Auto_Open sub which is a special procedure that runs when an add-in loads. More significantly, this sub does not trigger if the VBA is loaded inside a PowerPoint file such as a.pptm file. So how does one get round this? This sample demo initialises application events when the PowerPoinf file opens, without: Installing an add-in (that initiates code with Auto_Open) User interaction (to initialise the app events)

3 How to Create the Project (1/3) Insert a class module and name it clsAppEvents and insert the following code: Public WithEvents App As Application Click the (General) drop down and select App. You can then click the right hand drop down to select the event procedure you need for your code, for example: Private Sub App_WindowSelectionChange(ByVal Sel As Selection) MsgBox "Selection Changed", vbInformation + vbOKOnly, "App Event Class" End Sub

4 How to Create the Project (2/3) Insert a standard module and insert the following code: Public oEH As New clsAppEvents Public Sub onRibbonLoadAppEvents() Set oEH.App = Application End Sub Save the file as a PPTM and then close PowerPoint

5 How to Create the Project (2/3) Download and install the Custom UI Editor for Microsoft OfficeCustom UI Editor for Microsoft Office Open your PPTM file in the UI Editor Click Insert / Office 2007 Custom UI Part Insert the following code: Save the file and quit the Custom UI editor Start PowerPoint and open your PPTM file to see events firing!

6 at YOUpresent we develop communication content : presentations, e-learning, websites MSO software : macros and add-ins for PowerPoint, Excel, Word, Outlook


Download ppt "Ribbon-Activated PowerPoint Events Free VBA code from."

Similar presentations


Ads by Google