Fix an Excel VBA Module 1 Error from a Missing RegExp Reference
Question details
The user needs to resolve an Excel VBA Module 1 error associated with a missing Microsoft VBScript Regular Expressions reference.
- Product
- Microsoft Excel VBA
- Device & OS
- not provided
- Scenario
- A workbook uses a VBA form and regular expressions for validation and calculation.
- Observed behavior
- The missing or unavailable reference can cause a Module 1 error and prevent validation and calculation routines from running.
Open the workbook in Excel and press Alt+F11 to inspect its VBA project. In the VBA editor, check Tools > References for a missing Microsoft VBScript Regular Expressions 5.5 entry and confirm that you can edit the affected code.
Replace the Missing RegExp Reference with Late Binding
Use late binding to remove the project's compile-time dependency on the missing reference.
Late binding removes the VBA reference requirement, but the VBScript.RegExp component must still be available on the computer when the code runs.
In the VBA editor, select the workbook project, open Tools > References, clear the checked MISSING: Microsoft VBScript Regular Expressions 5.5 entry, and click OK.
In Project Explorer, open Module1 and replace the early-bound declaration of OBJ_RE with `Dim OBJ_RE As Object`. Keep the declaration at a scope accessible to the routines that use it.
Open ThisWorkbook and inspect Workbook_SheetChange. Remove an obsolete `OBJ_RE As VBScript_RegExp_55.RegExp` declaration if it is no longer needed. In Module1, remove the OBJ_RE1 declaration only if the code no longer uses it.
In Module1, find the validate function and add `Set OBJ_RE = CreateObject("VBScript.RegExp")` after its declarations and before the first use of OBJ_RE. Preserve the existing validation logic.
Choose Debug > Compile VBAProject, fix any remaining reference or scope errors, and save the workbook as a macro-enabled file. Return to the form and test Validate and Calculate.

Restore the RegExp Reference if It Is Available
Keep the existing early-bound code if the correct reference is available on the computer.
Work with Excel Spreadsheets in WPS Office
WPS Office is a free, lightweight Office alternative with a familiar spreadsheet interface. Open compatible Excel files and continue everyday spreadsheet work with a straightforward transition from Microsoft Office.

Frequently Asked Questions
How do I find a missing VBA reference in Excel?
Press Alt+F11, select the workbook project, and open Tools > References. Look for a checked entry beginning with MISSING.
What does late binding change in the VBA code?
Late binding declares the RegExp variable as Object and creates it at runtime with `CreateObject("VBScript.RegExp")`, rather than relying on a selected RegExp reference at compile time.
Why does CreateObject still fail after I remove the reference?
Removing the reference does not install the underlying component. Check whether VBScript.RegExp is available and supported in the environment where the workbook runs.
Should I delete every OBJ_RE declaration in the workbook?
No. Keep a declaration with the scope needed by the routines that use OBJ_RE. Remove an old declaration only after checking that it is obsolete and that the remaining code can access the intended variable.
Can WPS Office fix Excel's missing VBA reference?
No. The reference is part of the Excel VBA environment, so use Excel's VBA editor to fix it. WPS Office is an alternative for everyday spreadsheet work; test any macro-dependent workbook separately before relying on it.




