Table of Contents

VBC09341 — Can't assign to read-only property

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

A property that can only be read is assigned with Let.

The class declares a Property Get of that name and no Property Let: the property can be read, and there is nothing that writes it.

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 Property Get with no Property Let. c.Value = 1 Add a Property Let Value to the class, or assign what the property reads.
A property of a module, the library's or your own, with no Property Let, that returns neither a Variant nor an object. Timer = 5 Assign a variable of your own.

Notes

Through an object declared As Object or Variant, the class is not known until the code runs: the assignment compiles, and raises error 451 when it runs.

See also


⏮️ VBC09340 Expected Function or variable | ⏭️ VBC09342 Wrong number of arguments or invalid property assignment


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