Results 1 to 4 of 4
  1. #1
    5 Star Lounger
    Join Date
    Jul 2003
    Location
    USA
    Posts
    728
    Thanks
    7
    Thanked 2 Times in 2 Posts

    Macro for View/Header (Word 2002,SR2)

    I am trying to record a macro that takes me to View/Header. I have
    Sub ViewHeader()

    If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
    ActiveWindow.Panes(2).Close
    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
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    End Sub

    This does not allow me to Close the H/F toolbar and work in the document. What piece of code do I need to insert, please.

    Thank you very much,

    Acer

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Macro for View/Header (Word 2002,SR2)

    The problem is that ViewHeader is the name of one of Word's built-in commands. Having a macro of the same name hijacks the built-in command and this causes confusion. If you rename the macro to (for example) GoToHeader, the problem should be gone.

  3. #3
    5 Star Lounger
    Join Date
    Jul 2003
    Location
    USA
    Posts
    728
    Thanks
    7
    Thanked 2 Times in 2 Posts

    Re: Macro for View/Header (Word 2002,SR2)

    Hans -

    The problem is indeed gone. It did not occur to me check if that name had been "taken." Obvious, tho.

    Many thanks!

    Acer

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Macro for View/Header (Word 2002,SR2)

    You can download a very useful list of commands in Excel or Pdf format from Word commands, and their descriptions, default shortcuts and menu assignments on the Word MVP site.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •