BeforeExecute Event

      Applies To

Occurs before a command executes.

Syntax

Event BeforeExecute (guid As String, id As Long, ByRef handled As Boolean)

This syntax has these parts:

Part Description
guid GUID for the command set.
id Index into the command set for the particular command.
handled Indicates to other handlers that the command should be considered as having executed. True is passed if the handler implemented the command. False is passed if the handler just performed some auxiliary task.

Remarks

Before executing the function that is declared to be the implementation of a command, the BeforeExecute event occurs. Any number of listeners may be registered for the event. Each listener executes when the event occurs.

If a listener claims it has implemented the command no other listener or function should try to implement the command. A listener claims to have implemented the command by returning True for the handled parameter. If all a listener does is perform some extra function that in no way was supposed to be performing the command, such as make a log entry that the command fired, or perhaps increment a counter displayed somewhere, then the listener returns False for the handled parameter.