The "Property Let procedure not defined" compile error in VBA Excel appears when your code reads or assigns a property in a way the object does not expose, or when VBA needs a Property Let or Property Set to complete an assignment but cannot see one. The usual cause is solving for the wrong member: you point at a property that only has a Property Get, you mistype a member name, or the workbook containing the class module was renamed, moved, or lost its reference. Fixing it is almost always a matter of matching every assignment to a member that actually accepts a value, then rebuilding the project cleanly.
What You'll Need
- Excel with the VBA editor available (Alt+F11). If macros are blocked by policy, macros can't run at all; ask your IT admin rather than working around the block.
- The workbook whose module throws the error, open in the same Excel session.
- Passwords for any VBA project (VBAProject properties) you need to open. Every project in an open workbook is compiled together, even if the module you are editing looks fine.
- The class module or object library whose property you are assigning, or its documentation.
Step-by-Step
- Read the exact error text and stop the code. In the VBA editor, click Debug on the error message. The line highlighted is the assignment that failed. Note the member name to the right of the dot, for example
obj.UserName = "Bob". Treat this line as the suspect, not the class module, until you have checked it. - Confirm what kind of assignment it is. VBA has two distinct property writers: Property Let handles simple values (numbers, text, dates, Booleans), and Property Set handles object references such as ranges and collection members. Assigning an object through a Property Let member, or the reverse, raises this error even when the spelling is perfect.
- Check for a realty that only exposes a getter. Open the class module in the Project Explorer (double-click it), or press F2 for the Object Browser and search the name. If you see
Property Get UserNamebut noProperty Let UserName, that member is read-only and every write will fail. Either add a Property Let, or change the calling code so it writes through a method that exists. - Look for spelling and case mismatches. VBA is forgiving about case but not about spelling. A Property Let and its Property Get must share the exact same name; a matched pair like
Property Let FullnameandProperty Get FullNamewill not link, and VBA will report the writer as undefined. Confirm the name matches character for character across the pair. - Check the parameter list. Property Let must declare exactly one more argument than its Get counterpart, and that final argument must be the value being assigned and must be a simple data type, not an object. A typical working pair looks like this:
Private m_UserName As String
Public Property Get UserName() As String
UserName = m_UserName
End Property
Public Property Let UserName(ByVal NewValue As String)
m_UserName = NewValue
End Property
If the Let takes two arguments or takes an object, the assignment cannot resolve and the same error appears. The shorthand form Public Property Let UserName(ByVal NewValue As String) is only valid if the Get above it declares the same name.
- Make sure the module is not marked Private in the wrong place. A standard module declared as
Option Private Modulehides its procedures from other projects, so a caller in a different workbook will not see the Property Let even though it is Public. Also check the class module declaration itself. If the class isFriendmembers only, outside projects cannot bind to it. - Verify the variable actually holds the object you expect. Place the mouse cursor over the object variable, or add a quick line like
Debug.Print TypeName(obj)one line above the failing assignment. If the variable isNothingor holds a Worksheet where you expected your class, the property name is being looked up on the wrong type and VBA cannot find the writer. Set the reference properly before assigning. - Force a clean compile. In the VBA editor, use Debug > Compile VBAProject. A full project compile catches broken references and mismatched signatures that the line-by-line run skipped. If compilation is refused, click the first highlighted error in the list and fix it before fixing the current one, because VBA compiles all projects in one pass.
- Rebuild the reference if it is broken. If the class lives in another workbook that was renamed or moved, the reference to that workbook (see Tools > References) or an Add-in may show as Missing. Remove the stale reference and re-add it from the References dialog, then compile again.
- Re-test with a minimal assignment. Once the member is visible and correctly paired, run your original line again. If it now succeeds, the shared compile state was stale rather than your code, and the fix is to always compile after adding a new Property pair.
Common Mistakes
- Writing the pair in uneven places. Putting Property Get in one class and Property Let in a different one means neither object has a complete property.
- Mixing Get, Let and Set. Assigning an object to a Property Let member resolves as an error even though the code looks right; Change Set to Let or vice versa to match the declaration.
- Editing the wrong module. A copy of the class in a different workbook is not the class your code calls; confirm the module path in the Project Explorer before editing.
- Assuming a hidden error is gone. If the line is inside a rarely run branch, the error can disappear when the branch does not execute; compile instead of just running.
- Adding the writer but not compiling. Adding a Property Let to one module does not update the other module's view until the project is compiled, so build it before testing.
Tips
- Keep properties in a class module, not a standard module, unless you genuinely need a static public procedure as a property on a form.
- Name the argument of the Property Let exactly like the value it stores (for example
NewValue) so the pairing is obvious. - Compile every time you add or rename a property; it is faster than chasing stale references later.
- Use the Object Browser (F2) to confirm whether a member is read-only before you write against it.
- When passing an object from one project to another, confirm the public type is visible in both, not marked Friend.
Troubleshooting
- The error persists after compiling. Reopen the class, confirm the Let is Public and the exact name matches the Get, then compile again. A stale compiled state sometimes needs the workbook saved, closed, and reopened.
- It only fails when passing an object. The member is likely a Property Let receiving an object, which VBA rejects; convert it to a Property Set or change the caller.
- It fails only in a protected workbook. Locked projects are still visible to the compiler, so the real cause is usually a broken reference to a locked project. Open the project, check Tools > References, and fix the missing entry.
- A different error appears after editing. That is progress, and means the failed assignment now resolves; follow the new error rather than reverting the change.
- VBA refuses to let you compile at all. One or more references are missing or a syntax error sits above; fix those first, then return to the property check.
Frequently Asked Questions
Does "not defined" mean my property is missing entirely?
Not always. It can be present and unwritable, a spelling difference between the Get and the Let, a Private or Friend scope hiding the member, or a reference to the wrong object type.
Can a property be read-only?
Yes. A class with only a Property Get is read-only. Add a Property Let (for simple values) or Property Set (for objects) if the caller needs to write.
Why does it work in one workbook and not another?
The other workbook points at a class in a referenced project that is missing, renamed, or restricted by scope. Check the References dialog and the class's Public scope.
Is this an Excel bug?
No, it is a compile-time resolution error. The compiler cannot match the assignment to a visible, correctly typed writer on the object.
Do I need to restart the macro after fixing?
No, but you should recompile the project each time. Restart Excel only if the compiler still shows stale information after a successful compile.