Skip to content

VBA211 — Object assignment without Set

Severity: 🔴 error Category: assignment Phase: 2.2

Description

Assigning to an Object-typed variable without Set is a compile error in VBA.

Failing example

Dim col As Object
col = CreateObject("Scripting.Dictionary")

Compliant example

Dim col As Object
Set col = CreateObject("Scripting.Dictionary")

How to fix

Prepend Set to the assignment.


Source: src/rules.py — entry VBA211.