In a ClassModule (named 'Class1):
Option Explicit
Public WithEvents xlApp As Application
_________________________________________________________________
Private Sub Class_Initialize()
Set xlApp = Application
End Sub
_________________________________________________________________
Private Sub xlApp_WorkbookBeforePrint(ByVal Wb As Workbook, Cancel A
Boolean)
With PageSetup
.CenterHeader = "A HIT LIST - " & Range("A2").Value
End With
End Sub
In 'ThisWorkbook':
Option Explicit
_________________________________________________________________
Private Sub Workbook_Open()
Set gxlApp = New Class1
Set gxlApp.xlApp = Application
End Sub
In Module1 (there is only one module), as a separate procedure at th
top (along with other 'Public ...' statements):
Public gxlApp As Class1
In addition, 'Option Explicit' is the only coding for Sheet1, Sheet2
and for Sheet3.
All of the above is typically in an .xlA file (as I said, not as a
AddIn in Excel), but I am currently testing with all of the above in a
.xlS file. When I open a new workbook and execute a print macro (vi
clicking on a custom button), my custom header is not being printed.
Help!
Chuckles12