ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Running a macro if msgbox is yes (https://www.excelbanter.com/excel-programming/282703-running-macro-if-msgbox-yes.html)

Todd Huttenstine[_2_]

Running a macro if msgbox is yes
 
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

Chip Pearson

Running a macro if msgbox is yes
 
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

"Todd Huttenstine" wrote in message
...
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 Huttenstine[_2_]

Running a macro if msgbox is yes
 
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

"Todd Huttenstine"

wrote in message
...
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



.



All times are GMT +1. The time now is 09:12 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com