#1
|
|||
|
|||
Run 1 of 2 Macros Depending on Y/N Response to Message Box
Hi,
I'm trying to write a macro that uses the MsgBox function to select which one of two macros should be run. The actual macros themselves run fine, but trying to tie them together is proving difficult. I looked around online and couldn't find any clues, so this particular solution may not even be possible. I have this macro which functions as I'd expect it to: Sub MACRO() If MsgBox("Run Macro A?", vbYesNo) = vbYes Then Macro A End Sub I want to add something to the effect of: = vbNo Then Macro B If I substitute the vbYes line for this vbNo line it runs as expected but can't get it to do both without prompting two message boxes. It's so simple that I'm hoping there is an easy answer and I don't have to go about a completely different solution. Any help is greatly appreciated. |
#2
|
|||
|
|||
Hello!
Maybe somthing like that : Code:
Sub MACRO() If MsgBox("Run Macro A?", vbYesNo) = vbYes Then Macro A Else Macro B End If End Sub Souriane |
#3
|
|||
|
|||
That way or:
Code:
Sub RunOneOrTheOther() Select Case MsgBox("Do you want to run Macro A?", vbQuestion + vbYesNo, "Run Macro") Case vbYes: A Case vbNo: B End Select End Sub |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Help: Very low response-rate! | Jeff10 | Office | 6 | 12-17-2013 10:44 AM |
Reply All in auto response | Quackymacduck | Outlook | 0 | 10-12-2011 11:50 AM |
Failing calendar response | lucura | Outlook | 0 | 03-24-2011 01:01 AM |
appointments deleted from inbox upon response | Roscoe | Outlook | 1 | 03-03-2010 12:15 PM |
Unexpected Server Response | GreenAccord | Project | 0 | 01-31-2006 12:52 PM |