Deleting Multiple Headers & Footers

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)
 
G

Graham Mayor

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
S

Suzanne S. Barnhill

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.
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top