VBA & Macro Problems

How to Fix Sub or Function Not Defined and Missing Word Macros

Jason MillerJason Miller Nov 3, 2026 868 views

Question details

Users need to recover missing macros and resolve a specific VBA error that occurs when attempting to run them.

How to Fix Sub or Function Not Defined and Missing Word Macros
Product
Word
Device & OS
not provided
Scenario
Attempting to run an existing macro in a Word document or accessing the macro list.
Observed behavior
Word displays a 'Sub or Function not defined' error, and the previously available macros are no longer visible in the macro list despite the VBA editor opening successfully.
Before you start

Before troubleshooting, ensure you have a recent backup of your Normal template and check that macro execution is enabled in your Word Trust Center settings.

Solution 1Recommended

Locate and Restore Macros from the Normal Template

Recorded macros are typically stored in the Normal template. Checking and restoring this template can recover missing macros.

By default, Word saves newly recorded macros to a specific module within the global Normal template. If this template is corrupted or replaced, your macros will disappear from the list.

1
Open the VBA Editor

Press the 'Alt + F11' keys on your keyboard simultaneously to open the Visual Basic for Applications (VBA) editor in Word.

2
Locate the Normal Project

In the Project Explorer pane on the left side of the window, locate and expand the project named 'Normal'.

3
Check the Modules Folder

Look for the 'Modules' folder within the Normal project and check if a module named 'NewMacros' is present.

4
Restore a Template Backup

If the 'NewMacros' module is missing or empty, locate your previous backup of the Normal.dotm file and replace the current one in your templates folder to restore the missing macros.

Locate and Restore Macros from the Normal Template
Macro Storage Default: Recorded macros save to the Normal template by default, making them globally available across all new blank documents you create.
Free Microsoft Office alternative

Switch to WPS Office for a Seamless Word Processing Experience

If you are frequently encountering missing template errors or complex macro issues in Microsoft Word, consider switching to WPS Office. It provides a lightweight, fast, and free alternative with excellent compatibility for your everyday document needs.

Highly compatible with Microsoft Word formats including .docx, .doc, and .dotm.Lightweight design that uses fewer system resources and opens files instantly.Familiar user interface for a zero-learning-curve transition without complex troubleshooting.Free built-in PDF editing, document conversion tools, and rich formatting options.
microsoft office alternative - wps office

Frequently Asked Questions

Why am I getting the 'Sub or Function not defined' error in Word?

This error occurs when the VBA code attempts to call a macro or function that has been deleted, renamed, or is stored in a template/document that is not currently open or loaded in Word.

Where are my recorded macros saved by default?

By default, Word saves newly recorded macros in the Normal template (Normal.dotm) under a module typically named 'NewMacros'.

Can I recover deleted macros in Word?

If you have a backup of your Normal.dotm file or the specific document or global template where the macros were originally saved, you can recover them by restoring that backup file.

How do I edit macros stored in a global template?

To edit macros stored in a global template, you must open the actual template file directly in Word. You cannot edit the macro code while the template is merely loaded as a background add-in.