RDC00120: Implicit unbound default member access
Severity: Warning · Family: RDC (Rubberduck Core analyzers) ·
Raised by: ImplicitUnboundDefaultMemberAccessAnalyzer
A variable declared As Object is used as a value, or is assigned a value without Set.
VBA calls the default member of the object it holds (RD-VBAL §5.6.2.2 Evaluation to a simple data value). Which member that is depends on the object, and is known only when the code runs. An object whose class has no default member raises run-time error 438 (Object doesn't support this property or method).
A Variant that holds an object is not reported: nothing says it holds one before the code runs.
The finding is the variable.
How it is raised
| Situation | Example | Resolution |
|---|---|---|
An Object used as a value. |
Dim source As Objecttotal = source |
Name the member: total = source.Value; or declare the variable with its class. |
A value assigned to an Object. |
source = 42 |
source.Value = 42. |
See also
- RD-VBAL §2.6.4 Rubberduck Core Diagnostics
RDC00119: the same, of an object of a known classRDC00122: an argument list given to anObject
ACCUEIL • HOME | ℹ️ BIENVENUE • WELCOME | 🧩 BÂTISSONS • BUILD | RD-VBAL | SDK | 🌐 rubberduckvba.ca