Search notes:

PowerPoint: basics of event handling with VBA

In order to handle PowerPoint events in VBA, a class (stored in a class module) and a regular VBA module are needed.

evt.cls

The class module is needed to declare a class that receives the events, here: evtReceiver and its method(s) which will be called when the associated event is raised.
option explicit

public withEvents evtReceiver as application

private sub evtReceiver_slideShowBegin(byVal wn as slideShowWindow) ' {

    debug.print "slide show started at " & now()

end sub ' }
Github repository about-MS-Office-object-model, path: /PowerPoint/events/basic/evt.cls
Note: the name of the class module (here: evt) is needed in the regular module, see below.

Module

The regular module is needed to declare a variable whose type corresponds to the name of the class module (here evt), to create an instance of that object with new and to assign application to the variable's evtReceiver member.
option explicit

private evt_ as evt

sub initEvt ' {

    set evt_ = new evt
    set evt_.evtReceiver = application

end sub ' }
Github repository about-MS-Office-object-model, path: /PowerPoint/events/basic/module.bas

Index