Open the Macros dialog box:
Word 2007 and later versions: Select Developer tab > Macros.
Word 2003 and earlier versions: Select Tools > Macro > Macros.
Where it says Macros in, select the document or template you
want to store the macro in; where it says Macro name, type a name, and
click Create.
You will see something like:
Sub MyMacroName()
'
' MyMacroName Macro
' Macro created 03/01/17 by Me'
End Sub
You can safely delete the lines in the middle, and add your own code.