Change text when printed

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a footer containing the line "This is a controlled document."

This is what I want to appear when the document is viewed. However, when
the document is printed I want the line to read:
"This is an uncontrolled copy of a controlled document."

This is fairly easily accomplished using Adobe Acrobat (by inserting a field
on top of the original text that contains the "print" text, and set the field
to print only. Is there a way to accomplish the same thing from within Word
(2003)?
 
You can do this by intercepting the FilePrint and FilePrintDefault commands
with macros. The task will be relatively easy if you are dealing with a
single-section document with one footer, in which case something like this
should work:

Sub FilePrintDefault()
ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary) _
.Range.Text = "This is an uncontrolled copy of a controlled document."
ActiveDocument.PrintOut

End Sub

Sub FilePrint()
ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary) _
.Range.Text = "This is an uncontrolled copy of a controlled document."
Application.Dialogs(wdDialogFilePrint).Show

End Sub

Note that with these simple macros you will have to close the documents
without saving. If not, the new footer text will be saved with the document.

Add the macros in the template attached to the document. If you need
assistance, see http://www.gmayor.com/installing_macro.htm.

For more advanced macros, ask in a programming newsgroup, such as
microsoft.public.word.vba.general.

See also http://word.mvps.org/faqs/macrosvba/InterceptSavePrint.htm.

--
Stefan Blom
Microsoft Word MVP


in message
news:[email protected]...
 
Back
Top