View Single Post
 
Old 01-12-2021, 04:44 PM
macropod's Avatar
macropod macropod is offline Windows 10 Office 2016
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

Since the content controls aren't being updated, that suggests Greg's delay implementation after '.PrintOut' won't make any difference.

Here's another version of the code:
Code:
Private Sub wdApp_DocumentBeforePrint(ByVal Doc As Document, Cancel As Boolean)
Application.ScreenUpdating = False
Dim CCtrl As ContentControl, objUndo As UndoRecord
Set objUndo = Application.UndoRecord: objUndo.StartCustomRecord
With Doc
  For Each CCtrl In .ContentControls
    With CCtrl
      If .Type <> wdContentControlPicture And .Type <> wdContentControlCheckBox Then
        If .Range.Text = .PlaceholderText Then
          .Range.Text = "_________________________"
        End If
      End If
    End With
  Next
  .PrintOut
  objUndo.EndCustomRecord
  .Undo
End With
Cancel = True
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote