188.8.131.52 RaiseEvent Statement
A <raiseevent-statement> invokes a set of procedures that have been declared as handlers for a given event.
raiseevent-statement = "RaiseEvent" IDENTIFIER ["(" event-argument-list ")"] event-argument-list = [event-argument *("," event-argument)] event-argument = expression
§ A <raiseevent-statement> MUST be defined inside a procedure which is contained in a class module.
§ <IDENTIFIER> MUST be the name of an event defined in the enclosing class module.
§ The referenced event’s parameter list MUST be compatible with the specified argument list according to the rules of procedure invocation. For this purpose, all parameters and arguments are treated as positional.
§ The procedures which have been declared as event handlers for the event are invoked in the order in which their WithEvents variables were initialized, passing each <event-argument> as a positional argument in the order they appeared from left to right. Assigning to a WithEvents variable disconnects all event handlers that it previously pointed to, and causes the variable to move to the end of the list. When an event is raised, the most-recently assigned WithEvents variable’s event-handling procedures will be the last to be executed.
§ If an <positional-param> for the event is declared as ByRef, then after each invocation of the procedure, the next invocation’s corresponding <event-argument> is initialized to the value that the parameter last contained inside its most recent procedure invocation.
§ Any runtime errors which occur in these procedures are handled by that procedure’s error-handling policy. If the invoked procedure’s error-handling policy is to use the error-handling policy of the procedure that invoked it, the effect is as if the invoked procedure were using the default error-handling policy. This effectively means that errors raised in the invoked procedure can only be handled in the procedure itself.
§ If an unhandled error occurs in an invoked procedure, no further event handlers are invoked.