Hi all,
I've got some code to update Excel page headers in my Workbook_BeforePrint method:
When I run this code and go to the print preview the header is there. When I just print the sheet using ws.Printout it is not.
How do I make sure the Page Header is correctly triggered?
Many thanks!
I've got some code to update Excel page headers in my Workbook_BeforePrint method:
Code:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")
ws.PageSetup.LeftHeader = ws.Range("A1").Value
End Sub
Public Sub PrintSheet()
Worksheets("Sheet1").PrintOut
End Sub
When I run this code and go to the print preview the header is there. When I just print the sheet using ws.Printout it is not.
How do I make sure the Page Header is correctly triggered?
Many thanks!