Consulting

Results 1 to 2 of 2

Thread: Insert / Remove Header and Footer

  1. #1

    Insert / Remove Header and Footer

    Can anyone help with code to remove the header and footer from a document, either section by section or document wide?
    Ta
    mturnbull

  2. #2
    Mturnbull,

    I'm very new to VBA as well but something like that should be quite easy to do using the built in macro recorder in MSWord. It's under the 'Tools' menu. This should get you started - perhaps another moderator or senior forum member can come up with a better one.

    [VBA]Sub ClearHeaderFooter()
    '
    ' ClearHeaderFooter Macro
    ' Macro recorded 10/27/2005 by JohnnyBravo
    '
    ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
    Selection.WholeStory
    Selection.Delete Unit:=wdCharacter, Count:=1
    If Selection.HeaderFooter.IsHeader = True Then
    ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
    Else
    ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
    End If
    Selection.WholeStory
    Selection.Delete Unit:=wdCharacter, Count:=1
    ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
    End Sub[/VBA]

Posting Permissions

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