Skip to content

VBA340 — RaiseEvent target has no matching Event declaration

Severity: 🔴 error Category: events Phase: 3.2

Description

Events can only be raised from the class that declares them.

Failing example

Sub Trigger()
    RaiseEvent NotDeclared
End Sub

Compliant example

Public Event Changed()
Sub Trigger()
    RaiseEvent Changed
End Sub

How to fix

Declare Public Event <Name>(...) at module level, or fix the event name.


Source: src/rules.py — entry VBA340.