VBC09347 — Object required
Severity: Error · Family: VBC (static semantics / abstract syntax tree) ·
Source metadata: VBCompileErrorInfo
A Set statement assigns to a variable that cannot hold an object.
Set makes a variable refer to an object. A variable declared as a number, a String, a Boolean or a Date holds a value, never an object.
MS-VBA reports the same error, with the same message (recorded in Excel).
This code is raised by StatementStaticSemanticsEvaluator.
How it is raised
| Situation | Example | Resolution |
|---|---|---|
A Set of a Long. |
Set n = New Collection |
Declare the variable as the object's class, Object or Variant. |
See also
⏮️ VBC09346 Assignment to constant not permitted | ⏭️ VBC09348 Named argument already specified
ACCUEIL • HOME | ℹ️ BIENVENUE • WELCOME | 🧩 BÂTISSONS • BUILD | RD-VBAL | SDK | 🌐 rubberduckvba.ca