A macro can be added to single document or to a template so that documents made from that template have the macro. By adding a macro to Normal.dotm, the global template, a macro is available to all documents.
Open the document that contains the macro.
Click View > Macros > View Macros.
In the Organizer dialog box, select Normal (global template) in the Macro Project Items available in list, if it is not already selected.
Select the macro you want to add to Normal.dotm, and then click Copy.
To make quick work of tasks that you do often, in the desktop version of Word you can bundle the steps into macros that run with a single click. In Word Online, you have to step through such tasks manually.
If you have Word, first click Open in Word to open your document in Word.
Then follow the instructions in Create or run a macro.
When you run the macro in Word and save the document, you’ll see the results of the macro when you reopen your doc in Word Online.