I have the following code in the BeforePrint section of VBE. The function works correctly when I print from the worksheet, but does not update the header when I print from a macro - even though it is accessing the event (I checked with debugger) Anyone have any ideas to correct this? Thanks!
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim Title
Title = ActiveSheet.Name & " " & Format(Right(ActiveWorkbook.Names("DataDate").Value, 5), "mm/dd/yyyy")
With ActiveSheet.PageSetup
.LeftFooter = ActiveWorkbook.FullName
.CenterHeader = Title
End With
End Sub
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim Title
Title = ActiveSheet.Name & " " & Format(Right(ActiveWorkbook.Names("DataDate").Value, 5), "mm/dd/yyyy")
With ActiveSheet.PageSetup
.LeftFooter = ActiveWorkbook.FullName
.CenterHeader = Title
End With
End Sub