VBC09304 — Invalid use of object
Severity: Error · Family: VBC (static semantics / abstract syntax tree) ·
Source metadata: VBCompileErrorInfo
An object is used where a value of another kind is required.
MS-VBA reports the same error: Invalid use of object.
This code is raised by ObjectValueStaticSemantics, PrecompilerLiveBranchEvaluator.
How it is raised
| Situation | Example | Resolution |
|---|---|---|
The Nothing literal is where a value is expected: assigned to a variable of a value type, an operand, an argument of a parameter of a value type or of a function that reads a value (RD-VBAL §5.5.1.1). |
n = Nothing, If x = Nothing Then, CStr(Nothing) |
Nothing has no value: to clear an object variable, Set it to Nothing; to test one, use Is Nothing. |
| A conditional-compilation expression is an object. | #If Nothing Then |
A condition is a number or a Boolean. |
See also
⏮️ VBC09303 Duplicate declaration in current scope | ⏭️ VBC09305 Invalid ParamArray use
ACCUEIL • HOME | ℹ️ BIENVENUE • WELCOME | 🧩 BÂTISSONS • BUILD | RD-VBAL | SDK | 🌐 rubberduckvba.ca