ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Dialog Box Control (https://www.excelbanter.com/excel-programming/273467-dialog-box-control.html)

John[_42_]

Dialog Box Control
 
I'm using "Application.Dialogs(xlDialogPrinterSetup).Sho w"
and am not sure on how to test if the "Ok" or "Cancel"
button is pressed. If the EndUser selects "Ok" the run
some code if "Cancel" is selected then End.

Thanks,
John


Rob Bovey

Dialog Box Control
 
"John" wrote in message
...
I'm using "Application.Dialogs(xlDialogPrinterSetup).Sho w"
and am not sure on how to test if the "Ok" or "Cancel"
button is pressed. If the EndUser selects "Ok" the run
some code if "Cancel" is selected then End.


Hi John,

Here's one way to do it:

Sub ShowPrinterSetup()
Dim bResult As Boolean
bResult = Application.Dialogs(xlDialogPrinterSetup).Show
If bResult Then
''' User clicked OK
Else
''' User clicked Cancel
End If
End Sub

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *




All times are GMT +1. The time now is 06:59 AM.

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