I tested your code by adding a couple of lines and then trying to print.
It won't actually print anything, it just tells you what the print area is.
Give it a try, maybe it will provide a clue...
'---
Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.PrintArea = ActiveCell.CurrentRegion.Address
MsgBox ActiveSheet.PageSetup.PrintArea
Cancel = True
End Sub
'---
And...
The Before_Print event only fires once and the code you have only
applies to the sheet you are looking at when you hit the print button.
If you are printing multiple sheets and want a particular cells current
region to print on each sheet, then you will need different code.
--
Jim Cone
Portland, Oregon USA
http://www.mediafire.com/PrimitiveSoftware
..
..
..
"Salgud" <(E-Mail Removed)>
wrote in message
news:59nqq5x145ak$.(E-Mail Removed)...
I'm missing something simple. I have the following code in ThisWorkbook:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.PrintArea = ActiveCell.CurrentRegion.Address
End Sub
But it's not happening, just prints the selected cell instead of the
Current Region. An Edit Goto Current Region selects the correct Current
Region. I copied the code from an online tutorial, and read a reviewed the
VBA Help, and can't figure out what's wrong. I'm in Win2000, XL2003.
Anybody see what I'm missing?
TIA