Link to home
Start Free TrialLog in
Avatar of rthunder
rthunder

asked on

Hide blank content control when printing Word2007 Document

I am creating a form in Word2007 that contains a number of content controls such as text and date-picker.  I remember once we could set a toggle that prevented the "empty" content control from showing when you print.  With legacy controls once could toggle the gray text field for example.

So how do I do this in Word2007?
Avatar of redrumkev
redrumkev
Flag of United States of America image

rthunder,

How are you doing?

Would it be possible to set the default text to a blank, which could be two sets of double quotes:

""

This will not show up as text, yet will not have the "empty" box come up.

If you were interested in a macro based solution, which would simply remove the "empty" when printing, try the following:
Sub RemoveDefaultTextToPrint()
Dim doc As Word.Document
Dim cc As Word.ContentControl

Set doc = ActiveDocument
For Each cc In doc.Contentcontrols
If cc.PlaceholderText = cc.Range.Text Then
cc.Range.Font.Hidden = True
Else
cc.Range.Font.Hidden = False
End If
Next
Application.Options.PrintHiddenText = False
doc.PrintOut
End Sub

Sub AutoOpen
ActiveWindow.View.ShowHiddenText = True
End Sub

Open in new window


The above code was from: http://www.techtalkz.com/microsoft-office-word/503762-form-leaving-empty-fields-empty.html however this solution might be an extra step you do not want.

Do you have "print hidden text" selected - this is located in options -> display.

Hope this helps,
Kevin
ASKER CERTIFIED SOLUTION
Avatar of rthunder
rthunder

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rthunder
rthunder

ASKER

It's quick and easy.  No code overhead.