Running a macro if msgbox is yes

  • Thread starter Thread starter Todd Huttenstine
  • Start date Start date
T

Todd Huttenstine

Below is a message box popup I have in a code. I have a
macro called "emailnow". What I would like is if the user
clicks yes when the messagebox pops up, the code run
macro "emailnow". If the user clicks no, the sub will end.


If MsgBox("Email Agents now?. Do you want to continue?",
vbYesNo) = vbNo Then
Exit Sub
End If



Can anyone tell me how to do this?

Thanx

Todd Huttenstine
 
Todd,

Try something like


If MsgBox("Email Agents now?. Do you want to continue?", vbYesNo) = vbNo
Then
Exit Sub
End If
EmailNow

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
well that was easy. Thank you.

-----Original Message-----
Todd,

Try something like


If MsgBox("Email Agents now?. Do you want to continue?", vbYesNo) = vbNo
Then
Exit Sub
End If
EmailNow

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




.
 
Back
Top