Hide placeholder text if nothing is entered

R

RachelT

Totally new user to Word as a Form tool - I have created a form with various
fields that may or may not be filled out depending upon the number of
applicants. Can I not print the placeholder text if nothing is entered in
the space?
Thank you!
 
J

Jay Freedman

Totally new user to Word as a Form tool - I have created a form with various
fields that may or may not be filled out depending upon the number of
applicants. Can I not print the placeholder text if nothing is entered in
the space?
Thank you!

Add the following macro to the template for the form (see
http://www.gmayor.com/installing_macro.htm if needed). It changes the
color of the placeholder to white, prints, and then restores the
color.

Sub FilePrint()
Dim cc As ContentControl
Dim col As Long

With ActiveDocument

' hide placeholders
For Each cc In .ContentControls
If cc.ShowingPlaceholderText Then
col = cc.Range.Font.Color
cc.Range.Font.Color = wdColorWhite
End If
Next

Dialogs(wdDialogFilePrint).Show

For Each cc In .ContentControls
If cc.ShowingPlaceholderText Then
cc.Range.Font.Color = col
End If
Next

End With
End Sub
 

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