Save without Header and Footer

W

Word.user

Hi,
I have application which launches a wrod template file, when I save it, I
want to just save the text part of it and not the header and footer.
How is it possible?

Thanks in Advance
 
S

Stefan Blom

The easiest way would be to use a template where the headers and footers are
blank. But if you are saying that you want a macro to delete header and
footer contents, you could use something like this:

Sub DelHeaderFooter()
Dim s As Section
For Each s In ActiveDocument.Sections
s.Headers(wdHeaderFooterEvenPages).Range.Text = ""
s.Headers(wdHeaderFooterFirstPage).Range.Text = ""
s.Headers(wdHeaderFooterPrimary).Range.Text = ""

s.Footers(wdHeaderFooterEvenPages).Range.Text = ""
s.Footers(wdHeaderFooterFirstPage).Range.Text = ""
s.Footers(wdHeaderFooterPrimary).Range.Text = ""

Next s
End Sub

--
Stefan Blom
Microsoft Word MVP


in message
news:D[email protected]...
 

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