ShowHiddenText assistance

T

Tjones8611

I thought this was going to be simple, but I m ust be over complicatin
things. I’m using Word 2007 to create a report template. I have heading
for multiple sections that I want displayed on the monitor, but not whe
the report is printed. I have used hidden text formatting and a macro t
automate the “Hidden Text” under options->Display without any luck. An
advice or suggestions for code? Basically, I want to auto-enable “Hidde
Text” anytime a user opens the template for creating a report.

Im using Word macro-Enabled Doc -> .docm to create the template, no
sure if this might be part of the problem

Code Im using:
With ActiveDocument
.ActiveWindow.View.ShowHiddenText = False 'Do not display hidde
text
.Application.Options.PrintHiddenText = False 'Do not print hidde
text
End Wit
 
S

Stefan Blom

Since you just want to prevent the hidden text from printing,
intercepting the FilePrint and FilePrintDefault commands should suffice.
Using Save As, turn your form into a macro-enabled template (if you
haven't already done that). Create a module and add the following code:

Sub FilePrint()
Dim IsHiddenTextPrinting As Boolean
IsHiddenTextPrinting = Options.PrintHiddenText

Options.PrintHiddenText = False
Dialogs(wdDialogFilePrint).Show

Options.PrintHiddenText = IsHiddenTextPrinting
End Sub

Sub FilePrintDefault()
Dim IsHiddenTextPrinting As Boolean
IsHiddenTextPrinting = Options.PrintHiddenText

Options.PrintHiddenText = False
ActiveDocument.PrintOut

Options.PrintHiddenText = IsHiddenTextPrinting
End Sub

Stefan Blom
Microsoft Word MVP
 

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