I have created a macro that gives me a message box when it is run.
Sub MyMacro()
MsgBox quot;My First Macroquot;
When I run it I get a message box that only has 1 option in it quot;OKquot;
Is there a way to create one that will give me a quot;Yesquot; or quot;Noquot; message
You will need to go msgbox(quot;MyfirstMacroquot;, vbyesno)
quot;Olliequot; gt; wrote in message
...
gt;I have created a macro that gives me a message box when it is run.
gt; Sub MyMacro()
gt; MsgBox quot;My First Macroquot;
gt; When I run it I get a message box that only has 1 option in it quot;OKquot;
gt;
gt; Is there a way to create one that will give me a quot;Yesquot; or quot;Noquot; message
Sorry
this works
Sub yesno()
MsgBox quot;helloquot;, vbYesNo
End Sub
quot;Olliequot; gt; wrote in message
...
gt;I have created a macro that gives me a message box when it is run.
gt; Sub MyMacro()
gt; MsgBox quot;My First Macroquot;
gt; When I run it I get a message box that only has 1 option in it quot;OKquot;
gt;
gt; Is there a way to create one that will give me a quot;Yesquot; or quot;Noquot; message
Ollie, here is one way,
Sub Message_box_test()
Msg = quot;Put message herequot;
Title = quot;Put title herequot;
Response = MsgBox(Msg, vbYesNo vbQuestion, Title)
If Response = vbNo Then
'your code if no is clicked here
MsgBox quot;you clicked noquot;
Exit Sub ' Quit the macro
End If'your code if Yes is clicked here
MsgBox quot;you clicked yesquot;
End Sub--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 amp; 2003
quot;Olliequot; gt; wrote in message
...
gt; I have created a macro that gives me a message box when it is run.
gt; Sub MyMacro()
gt; MsgBox quot;My First Macroquot;
gt; When I run it I get a message box that only has 1 option in it quot;OKquot;
gt;
gt; Is there a way to create one that will give me a quot;Yesquot; or quot;Noquot; message
Thanks Ryan. works well
Much appreciated
quot;Ryan Jonesquot; wrote:
gt; You will need to go msgbox(quot;MyfirstMacroquot;, vbyesno)
gt;
gt; quot;Olliequot; gt; wrote in message
gt; ...
gt; gt;I have created a macro that gives me a message box when it is run.
gt; gt; Sub MyMacro()
gt; gt; MsgBox quot;My First Macroquot;
gt; gt; When I run it I get a message box that only has 1 option in it quot;OKquot;
gt; gt;
gt; gt; Is there a way to create one that will give me a quot;Yesquot; or quot;Noquot; message
gt;
gt;
gt;
Have created the Macro with success
Thank You very much
quot;Paul Bquot; wrote:
gt; Ollie, here is one way,
gt;
gt; Sub Message_box_test()
gt;
gt; Msg = quot;Put message herequot;
gt; Title = quot;Put title herequot;
gt; Response = MsgBox(Msg, vbYesNo vbQuestion, Title)
gt;
gt; If Response = vbNo Then
gt; 'your code if no is clicked here
gt; MsgBox quot;you clicked noquot;
gt; Exit Sub ' Quit the macro
gt; End If
gt;
gt;
gt; 'your code if Yes is clicked here
gt; MsgBox quot;you clicked yesquot;
gt; End Sub
gt;
gt;
gt; --
gt; Paul B
gt; Always backup your data before trying something new
gt; Please post any response to the newsgroups so others can benefit from it
gt; Feedback on answers is always appreciated!
gt; Using Excel 2002 amp; 2003
gt;
gt; quot;Olliequot; gt; wrote in message
gt; ...
gt; gt; I have created a macro that gives me a message box when it is run.
gt; gt; Sub MyMacro()
gt; gt; MsgBox quot;My First Macroquot;
gt; gt; When I run it I get a message box that only has 1 option in it quot;OKquot;
gt; gt;
gt; gt; Is there a way to create one that will give me a quot;Yesquot; or quot;Noquot; message
gt;
gt;
gt;
Thanks Again Ryan
quot;Ryan Jonesquot; wrote:
gt; Sorry
gt; this works
gt;
gt; Sub yesno()
gt; MsgBox quot;helloquot;, vbYesNo
gt; End Sub
gt;
gt; quot;Olliequot; gt; wrote in message
gt; ...
gt; gt;I have created a macro that gives me a message box when it is run.
gt; gt; Sub MyMacro()
gt; gt; MsgBox quot;My First Macroquot;
gt; gt; When I run it I get a message box that only has 1 option in it quot;OKquot;
gt; gt;
gt; gt; Is there a way to create one that will give me a quot;Yesquot; or quot;Noquot; message
gt;
gt;
gt;
- Aug 14 Mon 2006 20:08
Message Box
close
全站熱搜
留言列表
發表留言