View Single Post
 
Old 09-10-2022, 04:57 PM
KATSLaw2023 KATSLaw2023 is offline Windows 10 Office 2016
Novice
 
Join Date: Sep 2022
Location: Newark, Ohio USA
Posts: 1
KATSLaw2023 is on a distinguished road
Default New to Macros: Cannot remove Header/Footer: MS Word

I have managed not to need how to use macros all of these years, until finding out that I have this magical header which is only magical because I've done everything that I know to remove it and it remains, now I have other issues because I have been playing with the developer settings. Another element to MS Word that I have never known about (all these years!).

I used the remove macro found online on a YouTube video, however the steps that was shown were not exactly the steps I used, because something didn't work out as I entered the macro script to visual basic, then I guess I was supposed to exit and return to the Word document, then to click on the macro-option and click run. Nothing happens when I do this.

Macro Code:
Code:
Sub RemoveHeadAndFoot()
    Dim oSec As Section
    Dim oHead As HeaderFooter
    Dim oFoot As HeaderFooter
    For Each oSec In ActiveDocument.Sections
        For Each oHead In oSec.Headers
            If oHead.Exists Then oHead.Range.Delete
        Next oHead
        For Each oFoot In oSec.Footers
            If oFoot.Exists Then oFoot.Range.Delete
        Next oFoot
    Next oSec
End Sub

The book is 900 pages, and in order to get the formatting correct for digital printing and paper back, I really need to remove the headers and footer so I can get the pages the way they are supposed to be in the published format.

All help is greatly appreciated!

Thank you so much!!
Reply With Quote