How to Batch Edit Word Document Metadata on Mac using VBA
Question details
The user needs to modify or remove document properties and metadata in bulk for multiple Word documents located in a specific folder on a Mac using a VBA macro.

- Product
- Microsoft Word
- Device & OS
- Mac
- Scenario
- Managing document metadata and properties for multiple files simultaneously without opening them manually.
- Observed behavior
- The user is looking for an automated VBA script to loop through every document in a chosen directory, target specific metadata fields, apply changes, and save the files automatically.
Before running any VBA macro that modifies multiple files automatically, it is highly recommended to create a backup copy of your target folder to prevent accidental data loss in case the macro targets the wrong fields.
Create and Run a VBA Macro to Batch Edit Metadata
Use a custom VBA macro in Word to loop through a specific folder on your Mac, automatically opening each file to modify or clear its metadata before saving and closing.
Because Mac sandboxing rules restrict background folder access, you may need to grant the word processor explicit permission to access the target folder when the macro runs. The VBA script utilizes built-in property collections to target fields like Author, Title, or Subject.
Launch Word on your Mac, navigate to the 'Developer' tab, and click 'Visual Basic'. Alternatively, press Option+F11 on your keyboard.
In the Visual Basic editor, right-click on your document project or the Normal template in the left pane, select 'Insert', and choose 'Module'.
Input your VBA code designed to loop through files. Use the 'ActiveDocument.BuiltInDocumentProperties' collection to specify fields, for instance setting the 'Author' property to a new name or an empty string, followed by a 'ActiveDocument.Save' and 'ActiveDocument.Close' command.
Close the Visual Basic editor to return to your document. Click 'Macros' on the Developer tab, select your new batch editing macro from the list, and click 'Run'.

Automate Document Management Seamlessly with WPS Office
WPS Office provides excellent built-in support for running VBA macros and modifying document properties, making bulk editing tasks fast and efficient.
- 1. Install WPS Office: Download and install WPS Office on your computer for a streamlined document editing experience.
- 2. Enable Developer Tools: Open WPS Writer, click the 'Menu' button, go to 'Options', and customize your ribbon to display the 'Developer' tab.
- 3. Run Your VBA Script: Open the WPS VBA editor, paste your batch-processing metadata script, and execute it to automatically modify your folder's documents.

Frequently Asked Questions
Can I remove all personal information from a Word document without VBA?
Yes, you can manually remove properties by navigating to 'File' > 'Info' > 'Check for Issues' and using the 'Inspect Document' tool to strip personal information. However, doing this for an entire folder simultaneously still requires a VBA macro.
Why does my VBA macro fail to open files on a Mac?
macOS utilizes a security feature called sandboxing, which prevents applications from reading or modifying files in folders without explicit user permission. You may need to update your macro to use AppleScript integrations or manually grant folder access.
How do I view document metadata before changing it?
You can view current metadata by clicking 'File' > 'Properties' (or 'Summary Info'). This will display the built-in properties such as Author, Company, Title, and Creation Date.




