-
Question on MsgBox
Hello all. I am rather new at this. I have a code written that asks the user if they want to import the data they are working with, and it does so with a MsgBox code with the vbYesNo command, so they can click YES or NO. How do I use the returned value on this to either quit the function, or go to the next part when it will import the data? Here is an example of what I have, can someone help me?
MsgBox "Do you want to import the data?", vbYesNo
If VbYesNo = 2 then Exit Function
I assume that since the other possible value is the 1 for YES, that it will automatically progress to the lines of code directly below it. Help!
Thanks,
Bill Garrett
-
Re: Question on MsgBox
if MsgBox ("Do you want to import the data?", vbYesNo) = vbNo then
Exit Function
else
...
Endif
-
Re: Question on MsgBox
See if this helps out...
retval = MsgBox("Yes or No", vbYesNo)
If retval = vbYes then
MsgBox "You hit yes"
else
MsgBox "You hit no"
End If
-
Re: Question on MsgBox
dim r
r = MsgBox ("Do you want to import the data?", vbYesNo)
if r = vbNo then Exit Sub
Iouri Boutchkine
[email protected]