View Single Post
  #2   Report Post  
Posted to microsoft.public.word.newusers
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default Hide placeholder text if nothing is entered

On Tue, 30 Mar 2010 12:00:01 -0700, RachelT
wrote:

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


--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.