VBC09322 — Event not defined
Severity: Error · Family: VBC (static semantics / abstract syntax tree) ·
Source metadata: VBCompileErrorInfo
A RaiseEvent statement names an event that the class module it is written in does not declare.
MS-VBAL §5.4.2.20 RaiseEvent Statement requires the statement to be defined inside a procedure of a class module, and its identifier to be the name of an event defined in that class module.
This code is raised by
StatementStaticSemanticsEvaluator.
The verbose detail names the event.
How it is raised
| Situation | Example | Resolution |
|---|---|---|
| The class module declares no event of that name. | RaiseEvent Opened in a class that declares Event Changed() |
Declare the event: Public Event Opened(). Or correct the name. |
| The statement is in a standard module, which declares no events. | RaiseEvent Changed in a standard module |
Move the statement into the class module that declares the event. |
| The event is declared by another class module. | RaiseEvent Changed in Sink, where Source declares Changed |
An event is raised by the class that declares it. A class that handles it declares a WithEvents variable of that class. |
Notes
The name after RaiseEvent is an event name, not a variable. It is not looked up as one, and it is never reported as an
undefined variable under Option Explicit.
See also
- VBC09323 — the arguments of a
RaiseEventdo not match the event's parameters - RD-VBAL §2.6.2 Semantic Compilation Errors
- RD-VBAL §5.4.2.20 RaiseEvent Statement
⏮️ VBC09321 Argument required for Property Let or Property Set | ⏭️ VBC09323 Wrong number of arguments or invalid argument for event
ACCUEIL • HOME | ℹ️ BIENVENUE • WELCOME | 🧩 BÂTISSONS • BUILD | RD-VBAL | SDK | 🌐 rubberduckvba.ca