Why ThisDocument.Path Differs From ActiveDocument.Path in Word for Mac
Question details
Understand why two Word VBA properties return different paths and how to get the active document's location.

- Product
- Microsoft Word for Mac
- Device & OS
- macOS
- Scenario
- A user runs VBA code stored in a document or template and wants the path of the document currently open.
- Observed behavior
- ThisDocument.Path can return the macro container's location, while ActiveDocument.Path returns the active document's location.
Open the document whose location you want and save it if it has not been saved yet. Check whether the VBA code is stored in that document, Normal.dotm, or another template.
Use ActiveDocument.Path for the open document
Use this property when the macro needs the folder containing the document currently active in Word.
ThisDocument refers to the document or template containing the code, so its path can differ from the active document's path.
In Word for Mac, open the document and select Tools > Macro > Visual Basic Editor.
In the macro, replace ThisDocument.Path with ActiveDocument.Path where you need the active document's folder. For example, use Debug.Print ActiveDocument.Path.
Make the intended document active, run the macro from Tools > Macro > Macros, and check the output in the VBA editor's View > Immediate Window.

Use ThisDocument.Path to locate the macro container
Keep this property when you need the folder of the document or template that contains the VBA code.
Edit Word documents with WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for opening and editing Word documents. Its format compatibility makes it easier to move everyday documents from Microsoft Office, although it does not fix Word for Mac VBA behavior.

Frequently Asked Questions
Why does ThisDocument.Path return a template folder?
ThisDocument refers to the document or template containing the VBA code. If the code is in Normal.dotm or another template, its path identifies that container rather than the active document.
How do I get the folder of the document I am editing?
Use ActiveDocument.Path in your Word VBA code. Make sure the intended document is active and has been saved.
Why is ActiveDocument.Path empty?
A new document that has not been saved has no saved folder path. Select File > Save, choose a location, and run the macro again.
How can I see both VBA path values?
Add Debug.Print ThisDocument.Path and Debug.Print ActiveDocument.Path to the macro. Run it and select View > Immediate Window in the VBA editor to inspect the output.




