I have aquired some VBA that gives me the option to remove headers from a word document to enable printouts to be printed on letterheaded paper. It works OK but i would like it to remove footers as well as headers.
Could anyone guide me in altering this code to suit.
Many thanks
Could anyone guide me in altering this code to suit.
Many thanks
Code:
Private Sub oApp_DocumentBeforePrint(ByVal Doc As Document, Cancel As Boolean)
Dim MyTemplate As String
Dim Remove As VbMsgBoxResult
Application.ScreenUpdating = False
Cancel = True
MyTemplate = ActiveDocument.AttachedTemplate.Name
If MyTemplate = "Quotation Template header option.dot" Then
Remove = MsgBox("Do you want to print the header/footer logos?", vbQuestion + vbYesNo)
If Remove = vbNo Then
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow.ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^g"
End With
Selection.Find.Execute
Selection.Copy
Selection.Delete Unit:=wdCharacter, Count:=1
ActiveDocument.PrintOut
DoEvents
Selection.Paste
Application.CommandBars("Header and Footer").Visible = False
DoEvents
Else
ActiveDocument.PrintOut
End If
End If
Application.ScreenUpdating = True
End Sub