Table of Contents

RDC00119: Implicit default member access

Severity: Information  ·  Family: RDC (Rubberduck Core analyzers)  ·  Raised by: ImplicitDefaultMemberAccessAnalyzer

An object of a known class is used as a value, or is assigned a value without Set, and the code does not name the member that gives or takes the value.

A class can have a default member. Where a value is expected and an object is given, VBA calls that member and uses what it returns (RD-VBAL §5.6.2.2 Evaluation to a simple data value). A Let assignment to an object assigns the value to its default member (RD-VBAL §5.4.3.8 Let Statement). The code reads as if it used the object itself, and the member it calls is hidden.

The finding is the object, or the target of the assignment.

How it is raised

Situation Example Resolution
An object used as a value. total = cell, with cell a Cell whose default member is Value Name the member: total = cell.Value.
An object passed to a parameter of a value type. Report cell, with Sub Report(ByVal amount As Long) Report cell.Value.
A value assigned to an object. cell = 42 cell.Value = 42.

An object assigned to an object without Set is RDC00125. A variable declared As Object, whose default member is known only at run time, is RDC00120. A target that names the default member, such as label.Caption = text or .Value = x in a With block, assigns that member, and is not reported.

See also


ACCUEIL • HOME | ℹ️ BIENVENUE • WELCOME | 🧩 BÂTISSONS • BUILD | RD-VBAL | SDK | 🌐 rubberduckvba.ca