PDA

View Full Version : Solved: How to insert "Are you sure? -> Yes/No" in code



sunilmulay
10-22-2008, 07:37 PM
How can I insert a simple: "Are you sure? -> Yes/No" sub within an existing macro, so that if a user clicks on the control linked to the macro, it pops up a dialog box with buttons for Yes and No, with Yes executing the Macro and No aborting it?
Thanks

Demosthine
10-22-2008, 08:02 PM
Good Evening.

Try this.


Private Sub cmdDelete_Click()
Dim intResponse as Integer

intResponse = MsgBox("Are you sure?", vbYesNo, "Delete?")

Select Case intResponse
Case vbYes
' Process commands.
Case vbNo
Exit Sub
End Select
End Sub


Scott

sunilmulay
10-24-2008, 07:50 AM
thank you!