VBC09377 — Expected variable or procedure, not enum type
Severity: Error · Family: VBC (static semantics / abstract syntax tree) ·
Source metadata: VBCompileErrorInfo
The name of an enumeration, such as Color, is written where a value, a variable or a procedure is.
Each member of an enumeration is a value, written after the enumeration's name and a dot: Color.Red, or just Red. The enumeration itself is a type,
and no value.
MS-VBA reports the same error, with the same message (recorded in Excel).
How it is raised
| Situation | Example | Resolution |
|---|---|---|
| An enumeration where a value is. | x = Color, Debug.Print Globals.Color, If Not Color Then |
Write the member meant: x = Color.Red. |
| An enumeration as the target of an assignment. | Color = 1 |
Assign to a variable declared As Color. |
Where an operator, a Set statement, Len, a With block or a For Each loop has an enumeration as its operand, the error is the one that place
reports: a Type mismatch, Variable required, VBC09378, or VBC09379.
See also
⏮️ VBC09376 Expected variable or procedure, not project | ⏭️ VBC09378 With object must be user-defined type, Object, or Variant
ACCUEIL • HOME | ℹ️ BIENVENUE • WELCOME | 🧩 BÂTISSONS • BUILD | RD-VBAL | SDK | 🌐 rubberduckvba.ca