.xlA FILE AND WorkbookBeforePrint APPLICATION-LEVEL EVENT

C

Chuckles123

I have started a new thread because of new information and moving thi
thread from 'Excel Miscellaneous' to 'Excel Programming'.

Using the coding below stored in an .xlS file, the custom header i
printed in each workbook that I subsequently open and print. However
when I store this same coding in an .xlA file, open up a workbook, an
then click on a custom button that I had previously set-up to prin
using a macro stored in the .xla file, the custom header is no
printed.

Does this coding need to be tweaked somehow?
Thanks for your assistance.
Chuckles123

This is the coding:

Under ‘ThisWorkbook’:

Option Explicit
Dim gxlApp As New Class1
_________________________________________________
____________________
Private Sub Workbook_Open()
Set gxlApp = New Class1
Set gxlApp.xlApp = Application
End Sub


Under Class1 (a named ‘Class Module’):

Option Explicit
Public WithEvents xlApp As Application
_________________________________________________
____________________
Private Sub xlApp_WorkbookBeforePrint(ByVal Wb As Workbook, Cancel A
Boolean)
With ActiveSheet.PageSetup
.CenterHeader = "&""Arial,Bold""&16A ""BLENDED"" HIT LIST - "
Range("A2").Value
End With
End Su
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top