Powerpoint VBA App_SlideShowBegin

To use the SlideShowBegin event in Powerpoint, you need to configure the class module as follows:

Public WithEvents App As Application Private Sub App_SlideShowBegin(ByVal Wn As SlideShowWindow) MsgBox "SlideShowBegin" End Sub 

Then, inside the non-class module, you must create an object of this type and install the application in the application.

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

Now, the only problem I am facing is that if you did not manually call InitializeApp using the Macro menu in Powerpoint, the events do not work. You must call this unit before everything can call at the beginning of the slide show, INCLUDING this sub.

How can I call this subsection before starting my powerpoint? Is there a better way to do this?

EDIT:

I tried to use Class_Initialize, but it is called only after its first use or you do an operator like Dim X as Class1; X = new Class1 Dim X as Class1; X = new Class1

+6
source share
1 answer

Typically, event handlers are installed as part of the add-in, where you initialize the class in the Auto_Open routine, which always runs when the add-in loads. If you want to include an event handler in one presentation, one way to invoke it for init is to include a form that, when a mouse or click starts a macro, is in your event handler and moves on to the next slide.

+1
source

Source: https://habr.com/ru/post/914376/


All Articles