How to Export and Share a Word 2016 Macro
Question details
Export a Word 2016 macro or share its code with another user.

- Product
- Microsoft Word 2016
- Device & OS
- not provided
- Scenario
- A user wants to transfer a Word macro to another user's VBA project.
- Observed behavior
- The recipient needs a module file or macro code that can be added to a VBA project in Word.
Open Word 2016 and identify the document or template that contains the macro. In the Visual Basic Editor, check whether the macro is in a standard module by itself or alongside other code.
Export the macro module as a .bas file
Use this method to share a standard module, especially when it contains only the macro you want to send.
In Word, press Alt+F11 to open the Visual Basic Editor. If Project Explorer is hidden, select View > Project Explorer.
In Project Explorer, expand the relevant document or template project and its Modules folder, then open the module containing the macro.
Right-click the module in Project Explorer, select Export File, and save the resulting .bas file.
Send the .bas file to the recipient. In their Visual Basic Editor, they can select the destination project, choose File > Import File, and select the .bas file.

Copy an individual macro into a text file
Use this method when the module contains other macros that you do not want to export.
Work with Word documents in WPS Office
WPS Office is a free, lightweight alternative for working with Word documents. Its familiar interface and Microsoft Office format support make it easy to move everyday document work across, although it does not export macros from Word's VBA editor.

Frequently Asked Questions
Does exporting a module export every macro in it?
Yes. Right-clicking a standard module and choosing Export File saves all its code in the .bas file. To share just one macro, copy its procedure into a text file instead.
Where should the recipient import the macro?
In the Visual Basic Editor, the recipient can select the destination document or template project in Project Explorer, then choose File > Import File and select the .bas file.
Why might an imported macro not run?
It may rely on helper code, references, or other components that were not included. Check the original VBA project for dependencies, and review Word's macro security settings before running code from a trusted source.
Can I save a macro in a regular .docx file?
A .docx file cannot store VBA macros. To retain macros in a document, use File > Save As and select a Word Macro-Enabled Document (.docm).




