View Single Post
  #9   Report Post  
Posted to microsoft.public.word.docmanagement
Stefan Blom Stefan Blom is offline
external usenet poster
 
Posts: 8,428
Default Print word document without header and footer

You are welcome. :-)

--
Stefan Blom
Microsoft Word MVP


"Lee" wrote in message
...
Hi Stefan

Thats sorted that! Nice one thanks!

All the best!

Lee

"Stefan Blom" wrote:

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.Hidd en = True
s.Headers(wdHeaderFooterFirstPage).Range.Font.Hidd en = True
s.Headers(wdHeaderFooterPrimary).Range.Font.Hidden = True

s.Footers(wdHeaderFooterEvenPages).Range.Font.Hidd en = True
s.Footers(wdHeaderFooterFirstPage).Range.Font.Hidd en = 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.Hidd en = False
s.Headers(wdHeaderFooterFirstPage).Range.Font.Hidd en = False
s.Headers(wdHeaderFooterPrimary).Range.Font.Hidden = False

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

Next s

End Sub

--
Stefan Blom
Microsoft Word MVP


"Lee" wrote in message
...
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

"Stefan Blom" wrote:

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.Hidd en = True
s.Headers(wdHeaderFooterPrimary).Range.Font.Hidden = True
s.Headers(wdHeaderFooterPrimary).Range.Font.Hidden = True

s.Footers(wdHeaderFooterEvenPages).Range.Font.Hidd en = True
s.Footers(wdHeaderFooterFirstPage).Range.Font.Hidd en = 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.Hidd en = False
s.Headers(wdHeaderFooterPrimary).Range.Font.Hidden = False
s.Headers(wdHeaderFooterPrimary).Range.Font.Hidden = False

s.Footers(wdHeaderFooterEvenPages).Range.Font.Hidd en = False
s.Footers(wdHeaderFooterFirstPage).Range.Font.Hidd en = 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.

--
Stefan Blom
Microsoft Word MVP


"Lee" wrote in message
...
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

"Stefan Blom" wrote:

Have you tried selecting the whole document and then printing the
selection?

--
Stefan Blom
Microsoft Word MVP


"Lee" wrote in message
...
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