View Single Post
 
Old 01-12-2021, 04:08 PM
gmaxey gmaxey is offline Windows 10 Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,427
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

Maybe a timing issue with the print spool. You might try:

Code:
Option Explicit
Public WithEvents oApp As Word.Application
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Private Sub oApp_DocumentBeforePrint(ByVal Doc As Document, Cancel As Boolean)
Application.ScreenUpdating = False
MsgBox "!"
Dim CCtrl As ContentControl, i As Long
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
  DoEvents
  Sleep 2000
  .Undo i
End With
Cancel = True
Application.ScreenUpdating = True
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote