ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA Problem - Print Preview (https://www.excelbanter.com/excel-programming/290737-vba-problem-print-preview.html)

carljonesuk[_3_]

VBA Problem - Print Preview
 
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

--
Message posted from http://www.ExcelForum.com


Chip Pearson

VBA Problem - Print Preview
 
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


"carljonesuk " wrote
in message ...
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 fit
contents to page and I want to excel to run amacro to return

them to
original size when i close the print preview!

Is this possible to do?

Any help would be useful!

Thanks

Carl Jones


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 03:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com