View Single Post
 
Old 11-06-2013, 03:23 PM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

What you would need for this to work is an event-driven 'DocumentBeforePrint' macro, coded along the lines of:
Code:
Private Sub oApp_DocumentBeforePrint(ByVal Doc As Document, Cancel As Boolean)
Application.ScreenUpdating = False
Dim CCtrl As ContentControl, i As Long
MsgBox "!"
With Doc
  For Each CCtrl In .ContentControls
    With CCtrl
      If .Type <> wdContentControlPicture And .Type <> wdContentControlCheckBox Then
        If .Range.Text = .PlaceholderText Then
          i = i + 1
          .Range.Text = "_________________________"
        End If
      End If
    End With
  Next
  .PrintOut
  .Undo i
End With
Cancel = True
Application.ScreenUpdating = True
End Sub
The above code looks at all content controls (except for Pictures and CheckBoxes) and replaces any placeholder text with a series of underscores. If you prefer, you could change the placeholder text font colour to white instead. After printing, the content controls are reverted to their previous state.

The message box exists merely to demonstrate that the macro has been called - it can be deleted once you have the code working correctly.

To see how to implement such a macro, go to: Intercepting events like Save and Print
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]

Last edited by macropod; 11-06-2013 at 11:35 PM. Reason: Added code for CheckBoxes
Reply With Quote