![]() |
#6
|
||||
|
||||
![]()
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] |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro code that prompts user to enter text, then does find/replace. | sfvegas | PowerPoint | 0 | 01-10-2016 08:02 PM |
Macro/VBA code to select ALL text in a textbox in microsoft excel and add a new row | jyfuller | Excel Programming | 11 | 06-01-2015 08:49 PM |
![]() |
AustinBrister | Word VBA | 8 | 05-28-2015 02:42 PM |
![]() |
ndnd | Word VBA | 10 | 01-06-2015 01:47 PM |
![]() |
simpleonline1234 | Word VBA | 1 | 02-25-2011 02:28 AM |