Table of Contents

VBC09346 — Assignment to constant not permitted

Severity: Error  ·  Family: VBC (static semantics / abstract syntax tree)  ·  Source metadata: VBCompileErrorInfo

A constant is assigned.

A constant has the value it is declared with, for as long as the code runs: Const declarations, and the members of an Enum, cannot be assigned.

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 constant of the code. Const Limit = 10 … Limit = 5 Declare a variable instead, with Dim.
A member of an enumeration. Color.Red = 3 Assign a variable of the enumeration's type.

See also


⏮️ VBC09345 Invalid use of property | ⏭️ VBC09347 Object required


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