ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Running Custom Code if "Entire Workbook" is Selected for Printing (https://www.excelbanter.com/excel-programming/372547-running-custom-code-if-entire-workbook-selected-printing.html)

rfedge

Running Custom Code if "Entire Workbook" is Selected for Printing
 
I would like to run some custom VBA code before printing an Excel workbook,
but only if the user has selected the option to print the Entire Workbook.
Does anyone know how I can determine if the user has selected "Entire
Workbook" from the print dialog? (The "BeforePrint" event occurs BEFORE the
print dialog is displayed; I want to run my code AFTER the print dialog has
been displayed, and then only if the user has selected the Entire Workbook be
printed).

Thanks very much!

Rob


NickHK[_3_]

Running Custom Code if "Entire Workbook" is Selected for Printing
 
That is an Excel (as opposed to a Windows) dialog and Excel does not expose
these settings (in say a JustBeforePrint event), so you cannot tell.
The easiest way would be to fake your own print dialog on a userform and use
that.
If you don't need/want to to the whole thing, maybe a simple:
InpuBox="Are you going to print the whole WB ?"
would surfice in the _BeforePrint event, if you trust the users will answer
correctly.

NickHK

"rfedge" <u26408@uwe ¼¶¼g©ó¶l¥ó·s»D:660c7b8ed7bea@uwe...
I would like to run some custom VBA code before printing an Excel workbook,
but only if the user has selected the option to print the Entire Workbook.
Does anyone know how I can determine if the user has selected "Entire
Workbook" from the print dialog? (The "BeforePrint" event occurs BEFORE
the
print dialog is displayed; I want to run my code AFTER the print dialog
has
been displayed, and then only if the user has selected the Entire Workbook
be
printed).

Thanks very much!

Rob





All times are GMT +1. The time now is 07:15 AM.

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