Hide placeholder text if nothing is entered

  • Thread starter Thread starter RachelT
  • Start date Start date
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!
 
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
 
Back
Top