Runtime Error 451: “Property Let procedure not defined and property Get procedure did not return an object,” explained and fixed

Error 451, “Property Let procedure not defined and property Get procedure did not return an object”, is the most bookish message in this family, and it is precise once unpacked. A class property can have up to three procedures: Property Get (read), Property Let (assign a value), and Property Set (assign an object). Error 451 fires when code assigns a plain value to a property that has only a Get, and that Get does not return an object VBA could forward the assignment into. In plain terms: the code tried to write to a property that was built read-only, using the wrong shape of write for it.

For people who just run the program

  1. This is a class-design issue in the code. It appears in component-style VBA where code assigns values to properties of class objects that were not built to accept them that way.
  2. Note the feature. Configuration and update features that set properties on helper objects are the usual call sites.
  3. No user action changes it. The property's procedures are fixed in the class's code.
  4. Report the number. 451 is rare and exact; it tells the maintainer the class is missing a Property Let (or the caller should be using Set).

For people who write the code

  1. Decide what the caller actually needs. If callers should assign values, the class needs a Public Property Let. If they should assign an object, they need Set at the call and the class needs a Property Set. The error means neither route was completed:
  2. ' Class has only:  Public Property Get Rate() As Double
    ' Caller tries:    cfg.Rate = 0.2        ' error 451
    ' Fix in the class:
    Public Property Let Rate(ByVal v As Double)
        mRate = v
    End Property
  3. The message's second clause matters for nested objects. When a property Get returns an object, VBA allows chained assignment into that object's default property. If the Get returns a non-object, the chain dead-ends, which is the exact situation the message describes.
  4. Keep Get/Let/Set symmetric in your own classes. A public readable property that callers will plausibly want to set should ship with its Let or Set from the start; adding it later is the fix for the 451 your callers are already hitting.
Error 451 is frequently misread as a missing-method error. It is not 438. The property exists; its write side does not, or the write is being attempted in the wrong form. Searching for a “missing” member sends the hunt in the wrong direction.

If it still happens

If the class visibly has a Property Let and 451 still fires, check the Let signature: its parameter type must match the Get return type's assignment shape. A mismatch (Let taking a different type than the value being assigned) makes the Let unusable for that assignment and produces this error rather than a type mismatch.

Common questions

What are Property Get, Let, and Set? The three procedures behind a class property in VBA: Get reads the value, Let writes a plain value, Set writes an object reference. A property can have any subset, and the subset defines what callers may do.

Why does the message mention the Get not returning an object? Because of a fallback: assigning to a property whose Get returns an object can forward the assignment to that object's default property. When the Get returns a plain value instead, there is nowhere to forward to, and the missing Let becomes the error.

Related errors

Runtime Error 443 · Runtime Error 423 · Runtime Error 438