VBA & Macro Problems

Fix an Excel VBA Module 1 Error from a Missing RegExp Reference

Muhammad TalhaMuhammad Talha Nov 14, 2026 868 views

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.
Before you start

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.

Solution 1Recommended

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.

1
Remove the missing reference

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.

2
Update the object declaration

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.

3
Remove obsolete declarations

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.

4
Create the RegExp object

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.

5
Compile and test

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.

Replace the Missing RegExp Reference with Late Binding
Component availability: If CreateObject fails, the RegExp component may be unavailable in the current environment. Late binding cannot create a component that is not installed or supported.
Free Microsoft Office alternative

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.

Open and edit common Excel formats, including XLSXUse familiar spreadsheet tools for calculations and data entryMove everyday spreadsheet work to a lightweight Office suiteWork with a free alternative to Microsoft Office
microsoft office alternative - wps 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.