msgbox
Hi Jo,
You don't have to assign the MsgBox to a variable, but the fact that you
specify Yes and No buttons is giving the user a choice, and so it is
reasonable to assume you are interested in that response.
MsgBox is a function, which means that it returns a result. You can capture
the value returned or ignore it if you want, but the syntax is different
depending upon your choice.
For all Functions, if you want to capture the value, it is
result = Function _Call([arg1[, arge2[, arg3[, ...]]]])
If you don'r want to capture the return value, you omit the brackets
Function _Call [arg1[, arge2[, arg3[, ...]]]]
Thus in your case, either of the following works, although in the second
case you will never know whichj button was pressed
a = MsgBox("message", vbYesNo, "title")
MsgBox "message", vbYesNo, "title"
--
HTH
Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
"Jo" wrote in message
...
Hi
Why does this not work?
MsgBox("message", vbYesNo, "title")
If I do this it does
a = MsgBox("message", vbYesNo, "title")
Why do I need to assign the result to a variable?
Thanks
Jo
|