Message box\Forms button

J

Jase4now

I have created a button for the FORMS toolbar that has a macro that deletes
data from a page to reset it. I would like to have a message come up when
the button is pressed asking if they really want to erase the data. If they
press YES, then I want the macro to run, If they press NO, then I just wan
the message box to close and go back to the spreadsheet.

I am stumped on this...Please help

Jase
 
D

Dave Peterson

Option Explicit
Sub YourMacroNameHere()
dim Resp as long

resp = msgbox(Prompt:="are you sure?",buttons:=vbyesno)

if resp = vbno then
exit sub
end if

'rest of your code

End Sub
 

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