Dialog Box Control

  • Thread starter Thread starter John
  • Start date Start date
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
 
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 *
 
Back
Top