Skip to content

VBA341 — RaiseEvent argument count mismatch

Severity: 🔴 error Category: events Phase: 3.2

Description

The number of arguments passed to RaiseEvent must match the event's parameter list.

Failing example

Public Event Changed(ByVal name As String, ByVal value As Variant)
Sub Trigger()
    RaiseEvent Changed("only-one-arg")
End Sub

Compliant example

Public Event Changed(ByVal name As String, ByVal value As Variant)
Sub Trigger()
    RaiseEvent Changed("a", 1)
End Sub

How to fix

Pass the matching number of arguments (respecting Optional / ParamArray).


Source: src/rules.py — entry VBA341.