Print word document without header and footer

L

Lee

Hiya
I have been looking all over the internet for the answer but have had no look.
We currently have a business letter head which we use for quotes etc... The
quotes are sent out by email electronically with the heaer and footer
included. However, we print onto headed paper and would like the option to
print without including the header and footer. Is there an option which i can
select in word to do this or is it a case of changing the code somewhere.
Any help would be appreciated!
Regards
Lee
 
L

Lee

Thanks Stefan! Worked a treat! Simple solution. Is there another way where
you can just select a box etc to not print the the header and footer. This
will make it a lot easier for staff who have to print it.

Many thanks in anticipation.

Lee
 
S

Stefan Blom

Well, you should be able to use a macro that formats header and footer
contents as hidden, prints the document, and then clears the formatting
again. The following is a simple version:

Sub PrintDocWithoutHeaderFooter()
Dim s As Section
For Each s In ActiveDocument.Sections
s.Headers(wdHeaderFooterEvenPages).Range.Font.Hidden = True
s.Headers(wdHeaderFooterPrimary).Range.Font.Hidden = True
s.Headers(wdHeaderFooterPrimary).Range.Font.Hidden = True

s.Footers(wdHeaderFooterEvenPages).Range.Font.Hidden = True
s.Footers(wdHeaderFooterFirstPage).Range.Font.Hidden = True
s.Footers(wdHeaderFooterPrimary).Range.Font.Hidden = True
Next s

Options.PrintHiddenText = False

Dialogs(wdDialogFilePrint).Show

For Each s In ActiveDocument.Sections
s.Headers(wdHeaderFooterEvenPages).Range.Font.Hidden = False
s.Headers(wdHeaderFooterPrimary).Range.Font.Hidden = False
s.Headers(wdHeaderFooterPrimary).Range.Font.Hidden = False

s.Footers(wdHeaderFooterEvenPages).Range.Font.Hidden = False
s.Footers(wdHeaderFooterFirstPage).Range.Font.Hidden = False
s.Footers(wdHeaderFooterPrimary).Range.Font.Hidden = False

Next s

End Sub

For instructions on how to attach the macro to a toolbar button (or to a
button on the QAT in Word 2007), see
http://www.gmayor.com/installing_macro.htm.
 
L

Lee

Hi Stefan

Thanks for your reply. The first option (print selection) doesnt work when
we go into two or more pages.

The macro works really well apart from the fact that the header still prints
on the first page. Your link to that website really helped me install it. I
have tried to modify the macro code to see if the header on page 1 will not
print, but have had no luck.

Please would you be as kind to modify the macro code so that the header on
page 1 does not print. The footer on page 1 and the header and footers on the
other pages does not print as requested.

I look forward to your reply!

Lee
 
S

Stefan Blom

I see that there is an error in the code I posted. Sorry about that! Use
this version instead:

Sub PrintDocWithoutHeaderFooter()
Dim s As Section
For Each s In ActiveDocument.Sections
s.Headers(wdHeaderFooterEvenPages).Range.Font.Hidden = True
s.Headers(wdHeaderFooterFirstPage).Range.Font.Hidden = True
s.Headers(wdHeaderFooterPrimary).Range.Font.Hidden = True

s.Footers(wdHeaderFooterEvenPages).Range.Font.Hidden = True
s.Footers(wdHeaderFooterFirstPage).Range.Font.Hidden = True
s.Footers(wdHeaderFooterPrimary).Range.Font.Hidden = True
Next s

Options.PrintHiddenText = False

Dialogs(wdDialogFilePrint).Show

For Each s In ActiveDocument.Sections
s.Headers(wdHeaderFooterEvenPages).Range.Font.Hidden = False
s.Headers(wdHeaderFooterFirstPage).Range.Font.Hidden = False
s.Headers(wdHeaderFooterPrimary).Range.Font.Hidden = False

s.Footers(wdHeaderFooterEvenPages).Range.Font.Hidden = False
s.Footers(wdHeaderFooterFirstPage).Range.Font.Hidden = False
s.Footers(wdHeaderFooterPrimary).Range.Font.Hidden = False

Next s

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