Skip to content

VBA210 — Set used on a scalar target

Severity: 🔴 error Category: assignment Phase: 2.2

Description

Set is only valid for Object / Class / Variant references. Scalar types use plain = (or Let).

Failing example

Dim s As String
Set s = "hello"

Compliant example

Dim s As String
s = "hello"

How to fix

Drop Set (or use Let s = …).


Source: src/rules.py — entry VBA210.