Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word Supressing header from printing

Status
Not open for further replies.

nashcom

MIS
Apr 12, 2002
91
GB
I need to write a macro that will print a document but not its FirstPage Header and Footer. Is there a specific switch to do this? Failing that, I wondered if it was possible to select the Header, delete its contents, select the Footer, delete its contents, print the document, then perform a couple of 'undo' commands to restore the deleted text. I'm using Word XP (2002) by the way.

This is the last piece of the jigsaw - all the other macros & forms are working fine now.

Thanks

David
 

There is certainly no option to do this. I am a bit confused about why you go to all the trouble of having a separate first page header and footer (pages, ultimately being print-related 'objects') and then don't want to print them.

However, deleting and restoring the text with
Code:
ActiveDocument.Sections(1).Headers(wdHeaderFooterFirstPage).Range = ""
ActiveDocument.Sections(1).Footers(wdHeaderFooterFirstPage).Range = ""

:
:
:

ActiveDocument.Undo 2
is easy enough

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
Thanks for that, Tony. I'll try it tomorrow.

The reasoning is....

The template creates the document with the headers & footers. When the user goes to print, it pops up a form that allows them to select various print options - the first is a 'good' copy to send to clients, and that comes out on quality paper with header & footer printed. However, another option is a 'File copy' for internal use, and that comes out on standard paper with no header & footer (the reasoning is to save money on toner-usage!), hence the need to suppress the header & footer. The firm has always had this policy, and previously it was done with a WordBasic command that re-inserted the header from AutoText.

Thanks again.
 

Thanks David,

Gotta be quick athe momemt ...

1. You can still use WordBasic
2. You don't really need to Undo if you're printing and then quitting - just make sure it's saved before the good print (or at least before deleting the header) and then quit without saving after the cheap print.

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top