It is possible to upload Word templates with Word macros (don't mix them up with Confluence macros). Word macros are little pieces of functionality embedded in Word files which can make handling Word files a lot easier. Word macros are written in Visual Basic and can be used for different purposes such as applying special formattings or calculate values. In the following we describe the necessary steps to create a *.docm template executing your macro code whenever the exported document is opened. For more information, see Microsoft Knowledgebase.
Word macros have been used for malicious things. Therefore a Confluence Admin or a Space Admin may have disabled Word macros in the export schemes.
To insert a macro:
- Open your Word template.
- Click the View tab, click Macros and View Macros.
The screen Macros is displayed.
- Enter a name for your macro in the field Macro name.
- Select your active document in the Macros in drop-down.
- Click Create.
The screen Microsoft Visual Basic for Applications is displayed.
- Insert your macro code.
- Click File > Save Document1.
The Screen Save as is displayed.
- Select Word Macro-Enabled Document (.docm) in the Save as type drop-down.
- Enter a name for your template in the File name field.
- Click Save.
The template is saved and the screen Microsoft Visual Basic for Applications is displayed.
- Click File > Close and Return to Microsoft Word.
The screen Microsoft Visual Basic for Applications is closed and you return to Word.
- Save your Word template.
You have now successfully inserted a macro in your Word template. To use the template for your exports, please enable templates with Word macros in the export scheme.