Dialog Box Control

J

John

I'm using "Application.Dialogs(xlDialogPrinterSetup).Show"
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
 
R

Rob Bovey

John said:
I'm using "Application.Dialogs(xlDialogPrinterSetup).Show"
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 *
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top