Mangu68 said:
I have a letter from which i can vary the content by changing my
selections from drop down lists. Not all drop down lists are
necessarily used, yet they still will print in the final document
"Choose an Item". How do i stop word 2007 from printing non-selected
drop down lists so they are invisible in the final letter.
I assume that you're referring to content controls rather than legacy
dropdown form fields, which don't show that text unless you specifically
create it.
Put these two macros in the template for the letter. The FilePrint macro
intercepts the Print command from the Office button and the Ctrl+P shortcut,
and the FilePrintDefault macro intercepts the Quick Print button on the
Quick Access Toolbar.
Sub FilePrint()
Dim oCC As ContentControl
' white out any control showing placeholder text
For Each oCC In ActiveDocument.ContentControls
If ((oCC.Type = wdContentControlDropdownList) _
Or (oCC.Type = wdContentControlComboBox)) _
And oCC.ShowingPlaceholderText Then
oCC.Range.Font.Color = wdColorWhite
End If
Next
Dialogs(wdDialogFilePrint).Show
' restore original color
For Each oCC In ActiveDocument.ContentControls
If ((oCC.Type = wdContentControlDropdownList) _
Or (oCC.Type = wdContentControlComboBox)) _
And oCC.ShowingPlaceholderText Then
oCC.Range.Font.Color = wdColorAutomatic
End If
Next
End Sub
Sub FilePrintDefault()
Dim oCC As ContentControl
' white out any control showing placeholder text
For Each oCC In ActiveDocument.ContentControls
If ((oCC.Type = wdContentControlDropdownList) _
Or (oCC.Type = wdContentControlComboBox)) _
And oCC.ShowingPlaceholderText Then
oCC.Range.Font.Color = wdColorWhite
End If
Next
ActiveDocument.PrintOut Background:=False
' restore original color
For Each oCC In ActiveDocument.ContentControls
If ((oCC.Type = wdContentControlDropdownList) _
Or (oCC.Type = wdContentControlComboBox)) _
And oCC.ShowingPlaceholderText Then
oCC.Range.Font.Color = wdColorAutomatic
End If
Next
End Sub
--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.