Office for Mac Issues

Fix Word for Mac Macro Opening a Document Only Once

Camila MilosovichCamila Milosovich Nov 2, 2026 868 views

Question details

A custom macro assigned to a keyboard shortcut for opening frequently used documents stops functioning after Word for Mac is restarted.

How to Fix Word for Mac Macro That Opens a Document Only Once
Product
Microsoft Word for Mac
Device & OS
macOS
Scenario
Using a keyboard shortcut assigned to a recorded macro to quickly open specific, frequently used documents without using the mouse.
Observed behavior
The macro successfully opens the target document the first time it is run, but completely stops working after Microsoft Word is closed and reopened.
Before you start

Ensure that your target documents have not been renamed or moved from their original folders, and that the Developer tab is enabled in your Word ribbon.

Solution 1Recommended

Correct the Macro Declaration and Directory Path

Fix syntax errors in your VBA code, such as accidental comments and incorrect file paths, to ensure the macro executes properly every time.

When recording or writing a macro, minor syntax errors can prevent the code from running. An apostrophe before a command turns it into a comment, meaning Word will ignore it. Additionally, placeholder paths must be replaced with your actual system paths.

1
Open the Visual Basic Editor

Navigate to the Developer tab on the Word ribbon and click on 'Visual Basic', or press Option+F11 on your keyboard.

2
Remove the Apostrophe

Locate your macro code. Look at the very first line containing the 'Sub' command. If there is an apostrophe (') immediately before 'Sub', delete it. The apostrophe turns the declaration into a comment, causing the macro to fail.

3
Update the Home Directory Path

Scan the code for the file path. If it says '<Your Home Directory>' or something similar, replace it with your actual macOS home directory name (for example, '/Users/yourusername/Documents/filename.docx').

4
Save to the Normal Template

Ensure the macro is saved in the 'Normal.dotm' template rather than the specific document. This guarantees the macro remains available globally even after Word is restarted.

Correct the Macro Declaration and Directory Path
Syntax Verification: Once the apostrophe is removed, the 'Sub' command should change from green (commented text) to the standard syntax color (usually blue or black), indicating it is now active code.
Free Microsoft Office alternative

Manage Your Documents Easier with WPS Office

If you're struggling with complex macros just to open files quickly, WPS Office offers an intuitive interface with a tabbed viewing system, robust file pinning, and seamless compatibility with Microsoft Word documents—completely free.

  1. 1. Install WPS Office: Download and install WPS Office for free on your Mac.
  2. 2. Open Your Word Documents: Open your existing .docx files directly in WPS Office with perfect formatting preservation.
  3. 3. Pin Your Favorites: Use the WPS homepage to instantly pin your most-used documents for one-click access in the future.
100% compatible with Microsoft Word formats (.doc, .docx).Free, lightweight, and optimized for smooth performance on macOS.Tabbed document interface allows you to manage multiple files in a single window easily.Built-in file pinning and quick access features without the need for VBA coding.
microsoft office alternative - wps office

Frequently Asked Questions

Why did my macro code turn green in the Visual Basic Editor?

In the VBA Editor, green text indicates a comment. If an apostrophe (') is placed at the beginning of a line, the editor treats the entire line as a note rather than executable code. Removing the apostrophe will restore it to an active command.

How do I find my exact Home Directory path on macOS?

You can locate your exact path by opening the Terminal app and typing 'pwd', or by finding the file in Finder, right-clicking it, holding down the Option key, and selecting 'Copy as Pathname'.

Why do my recorded macros disappear when I restart Word?

This usually happens if the macro was saved to the specific document you were working on instead of the global template. To ensure a macro is available every time you open Word, save it to the 'Normal.dotm' template.

Can I open multiple documents with a single keyboard shortcut?

Yes, by writing a VBA macro that contains multiple 'Documents.Open' commands pointing to different file paths, you can open several documents at once. You can then assign this specific macro to a single custom keyboard shortcut.