I am using ms agent, and every time it moves, I want a diffrent message to apear random
please help
thanks in advance
Printable View
I am using ms agent, and every time it moves, I want a diffrent message to apear random
please help
thanks in advance
This will generate a random message:
Get the point? Hope this helps.Code:Private Sub Command1_Click()
Randomize
retVal = Int((5 * Rnd) + 1)
If retVal = 1 Then MsgBox "Message #1"
If retVal = 2 Then MsgBox "Message #2"
If retVal = 3 Then MsgBox "Message #3"
If retVal = 4 Then MsgBox "Message #4"
If retVal = 5 Then MsgBox "Message #5"
End Sub
YOu could use Choose like this:
Code:Msgbox Choose(int(Rnd*5+1),"M1","M2","M3","M4","M5")
ok, thanks to both for your help
If you need more information about messaggeboxes, Check it out. ;)
http://forums.vb-world.net/showthrea...threadid=25670