Click the View tab. Then click Record Macros on the menu.
![Then click View Macros on the menu.](http://www.java2s.com/Tutorial/Microsoft-Office-Word-2007Images/Record_Macro___Then_Click_View_Macros_On_Menu.PNG)
Type a name for the macro. Assign a shortcut key to use a keystroke combination. Or assign a button to run the macro.
![Or assign a button to run the macro.](http://www.java2s.com/Tutorial/Microsoft-Office-Word-2007Images/Record_Macro___Or_Assign_Button_To_Run_Macro.PNG)
Click the Store macros in list: select 'All Documents' to let this macro visible to all documents, or select 'Documents Based On' to set the macro to based on certain documents only, or select 'This Document': the macro is available only in this document.
![Select 'This Document': the macro is available only in this document.](http://www.java2s.com/Tutorial/Microsoft-Office-Word-2007Images/Record_Macro___Select_this_Document_Macro_Is_Avail.PNG)
Type a description. Click OK.
![Click OK.](http://www.java2s.com/Tutorial/Microsoft-Office-Word-2007Images/Record_Macro___Click_Ok.PNG)
Execute the commands or actions. Click the Stop Recording button.
![Execute the commands or actions.](http://www.java2s.com/Tutorial/Microsoft-Office-Word-2007Images/Record_Macro___Execute_Commands_Or_Actions.PNG)