View Single Post
 
Old 09-28-2016, 03:19 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
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

In that case, try the following macro. It doesn't yet test the DocType$ variable (first line in your code), because I don't know what the larger context is.
Code:
Sub PrintNoHeader()
Application.ScreenUpdating = False
Dim pState As Variant, bFit As Boolean, Sctn As Section, HdFt As HeaderFooter
Const Pwd As String = ""
With ActiveDocument
  .Save
  pState = False
  If .ProtectionType <> wdNoProtection Then
    pState = .ProtectionType
    .Unprotect Pwd
  End If
  For Each Sctn In .Sections
    For Each HdFt In Sctn.Headers
      With HdFt
        If .LinkToPrevious = False Then
          .Range.Text = vbNullString
        End If
      End With
    Next
  Next
  If pState <> wdNoProtection Then .Protect Type:=pState, NoReset:=True, Password:=Pwd
  Application.Dialogs(wdDialogFilePrint).Show
  Application.DisplayAlerts = wdAlertsNone
  .Reload
  Application.DisplayAlerts = wdAlertsAll
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote