VBA Problem - Print Preview

  • Thread starter Thread starter carljonesuk
  • Start date Start date
C

carljonesuk

Is it possible for excel to run a macro whebn i close Print Preview?

A macro runs to go to print preview to modify row height to fi
contents to page and I want to excel to run amacro to return them t
original size when i close the print preview!

Is this possible to do?

Any help would be useful!

Thanks

Carl Jone
 
Carl,

You can't do it for Print Preview exclusively. You can use the
BeforePrint event of the Workbook, but this executes for both
printing and print preview. Sadly, there is no AfterPrint
event, so you can't restore the settings you change in
BeforePrint. Put the following code in the ThisWorkbook code
module.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
' your code here
End Sub



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Back
Top