English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Here's my code:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.LeftFooter = "Owner: " & Range("d24").Value
End Sub

I've also run Application.EnableEvents = True in a separate macro, but it still doesn't work.

My macros are enabled.

Any other ideas? Does it matter how I start printing? I've clicked print icon, click File/Print, printed from a print preview

2007-03-12 09:19:27 · 2 answers · asked by billy b 3 in Computers & Internet Software

2 answers

It works with mine.

Did you put this inside thisworkbook module? Such events are trapped there.

2007-03-12 15:57:59 · answer #1 · answered by unnga 6 · 0 0

it is simple, you need to set the sheet name in the LeftFooter

Instead of this
"Owner: " & Range("d24").Value
do this
"Owner: " & Sheet1.Range( "d24").Value
or this
"Owner: " & Worksheets( "Sheet1").Range( "d24").Value

and you are done,
Workbook events all need to set a sheet name to reference

Enjoy my profile, I am the VBAXLMan

2007-03-13 11:23:13 · answer #2 · answered by Anonymous · 0 0

fedest.com, questions and answers