I know this is an Excel help site but I wondered if someone could help me modify a VBA that I developed (with help) for an excel spreadsheet so it will perform the same functions in a Word document form.
Here's the VBA
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Cancel = True
Application.EnableEvents = False
'set headers
With ActiveSheet
.PageSetup.LeftHeader = [a8].Value & " " & [c8].Value
.PageSetup.RightHeader = [a10].Value & " " & [C10].Value
'print sheet
.PrintOut
'reset headers
.PageSetup.LeftHeader = ""
.PageSetup.RightHeader = ""
End With
Application.EnableEvents = True
End Sub
Any help would be appreciated.
thanks,
John Ross
Here's the VBA
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Cancel = True
Application.EnableEvents = False
'set headers
With ActiveSheet
.PageSetup.LeftHeader = [a8].Value & " " & [c8].Value
.PageSetup.RightHeader = [a10].Value & " " & [C10].Value
'print sheet
.PrintOut
'reset headers
.PageSetup.LeftHeader = ""
.PageSetup.RightHeader = ""
End With
Application.EnableEvents = True
End Sub
Any help would be appreciated.
thanks,
John Ross