delete all headers and footers

Here at Southampton Exam Factory we have a lot of resources from an exam board for a now-defunct specification. The resources all have several footers and headers in gaudy textboxes with logos. Nobody cares now which section of the defunct syllabus the resources were created for. The macro below will remove them all with one click.

Sub RemoveHeaderAndFooter()

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

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: