Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to record a macro that involves the header/footer. I want to run the macro inside several files based on the same template.

While recording a macro, I cannot use the mouse to navigate through the text. Also, when a file is opened, the cursor position is at the main body. This is why I need a shortcut key to go to the header/footer.

share|improve this question
up vote 3 down vote accepted

You can define a shortcut key to go to header/footer in Word easily. Just follow these steps:

  1. Click the Office button, select Word Options, and click Customize.

  2. In the bottom of the window, click the Customize button beside Keyboard shortcuts.

  3. In the Customize Keyboard box, select Insert Tab in the categories. Now the commands will appear at the right side of the window.

  4. Scroll down to the bottom and select ViewFooterOnly command. When you select it, a brief description will appear at the bottom of the dialog box.

  5. Click inside the box labeled Press new shortcut key.

  6. Press the shortcut key you would like to use. Include the Ctrl, Shift, or Ctrl + Shift keys.

  7. If the shortcut key is currently assigned, Word will tell you what command currently uses the shortcut key

  8. You can reassign the shortcut key, or you can select a new one.

  9. Choose whether you'd like to save the shortcut key in the Normal template (all documents) or only the current document.

  10. Click Assign when you're happy with your changes.

  11. Go to step 4, and select ViewHeaderOnly command, assign a shortcut for it as well.

  12. Click Close. Now you have two shortcuts to go to header/footer in Word.

alt text

share|improve this answer
FYI: In Word 2010 the keyboard customisation button is at the bottom of the ribbon customisation page of options. – Richard Nov 5 '10 at 10:26
Excellent solution! Thanks! :) – Kit Nov 10 '10 at 5:01
@Kit: You're welcome. – Mehper C. Palavuzlar Nov 10 '10 at 7:30

When recording a macro in Word 2007 to add the Header & Footer this is what was generated. Hope this helps.

If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow.ActivePane.View.Type = wdOutlineView Then
    ActiveWindow.ActivePane.View.Type = wdPrintView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
ActiveDocument.AttachedTemplate.BuildingBlockEntries(" Blank").Insert Where:=Selection.Range, RichText:=True
Selection.TypeText Text:="HEADER"
Selection.TypeText Text:="FOOTER"
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .