VBC09376 — Expected variable or procedure, not project
Severity: Error · Family: VBC (static semantics / abstract syntax tree) ·
Source metadata: VBCompileErrorInfo
The name of a project or a library, such as VBA, is written where a value, a variable or a procedure is.
A project qualifies the names of what it declares: VBA.Len is the Len function of the VBA library, and VBA.Collection its Collection class.
By itself, the name of a project is none of them: it has no value to print, assign or pass, and it cannot be assigned or called.
MS-VBA reports the same error, with the same message (recorded in Excel). A module, such as Strings, is
VBC09363 Expected variable or procedure, not module instead, and an enumeration VBC09377.
How it is raised
| Situation | Example | Resolution |
|---|---|---|
| A project where a value is. | Debug.Print VBA, x = VBA, MsgBox Not VBA |
Write the member meant, after the project's name: Debug.Print VBA.Len(s). |
| A project as the target of an assignment. | VBA = 1 |
Assign to a variable. |
| A project as a statement. | VBA |
Call the procedure meant: VBA.Beep. |
Where an operator, a Set statement, Len, a With block or a For Each loop has a project as its operand, the error is the one that place
reports: a Type mismatch, Variable required, VBC09378, or VBC09379.
See also
⏮️ VBC09375 Invalid length for fixed-length string | ⏭️ VBC09377 Expected variable or procedure, not enum type
ACCUEIL • HOME | ℹ️ BIENVENUE • WELCOME | 🧩 BÂTISSONS • BUILD | RD-VBAL | SDK | 🌐 rubberduckvba.ca