VBC09367 — Invalid use of AddressOf operator
Severity: Error · Family: VBC (static semantics / abstract syntax tree) ·
Source metadata: VBCompileErrorInfo
An AddressOf expression names a method of a class module, or of an object.
The address AddressOf gives is that of a procedure of a standard module: a method of a class is reached through an object, and has none.
MS-VBA reports the same error, with the same message (recorded in Excel).
This code is raised where the arguments of a call are evaluated, at the AddressOf expression.
How it is raised
| Situation | Example | Resolution |
|---|---|---|
| A method of an object. | TakesPtr AddressOf c.Increment |
Pass the address of a procedure of a standard module. |
| A method of a class module. | TakesPtr AddressOf Counter.Increment |
Move the procedure to a standard module. |
See also
⏮️ VBC09366 A module is not a valid type | ⏭️ VBC09368 Invalid use of New keyword
ACCUEIL • HOME | ℹ️ BIENVENUE • WELCOME | 🧩 BÂTISSONS • BUILD | RD-VBAL | SDK | 🌐 rubberduckvba.ca