Deleting Multiple Headers & Footers

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi everybody,
I have a looooooooooong document consisting of multiple sections,
each with different headers & footers. Is there some easy way to
automatically remove all the headers and footers? Maybe even merge
all the sections into one?


<*((((><{
(e-mail address removed)
 
The following macro should remove all the headers and footers:

Sub RemoveHeadersAndFooters()
Dim oSection As Section, oHeaderFooter As HeaderFooter
For Each oSection In ActiveDocument.Sections
For Each oHeaderFooter In oSection.Headers
oHeaderFooter.Range.Delete
Next
For Each oHeaderFooter In oSection.Footers
oHeaderFooter.Range.Delete
Next
Next
End Sub


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
If you really want to merge all the sections into one, then use Find and
Replace to replace ^b with nothing. Then you'll be down to one section's
worth of header(s)/footer(s) to deal with.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
Hi Suzanne & Graham,
I love it! Two different responses, and both perfect for what
I'm needing to do! You guys are great.

<*((((><{
(e-mail address removed)

In the last exciting episode on Fri, 1 Oct 2004 06:42:33 +0100,

|The following macro should remove all the headers and footers:
|
|Sub RemoveHeadersAndFooters()
|Dim oSection As Section, oHeaderFooter As HeaderFooter
|For Each oSection In ActiveDocument.Sections
| For Each oHeaderFooter In oSection.Headers
| oHeaderFooter.Range.Delete
| Next
| For Each oHeaderFooter In oSection.Footers
| oHeaderFooter.Range.Delete
| Next
|Next
|End Sub
 
Back
Top