我是一个新手,已经写了一个VBS函数,但它总是给我一个错误。我已经搜索了MS站点,语法看起来是正确的。怎么啦?这是我尝试过的:
Function IsTheNumberTooLow()
IsTheNumberTooLow = intUserNumber < intRandomNo
MsgBox = "Your guess was too low. Try again", cGreetingMsg
End Function发布于 2017-07-30 07:22:38
您的某些语法不正确。我还猜测你的值是全局的,最好是在函数中传入或设置它们。尝试如下所示:
Function IsTheNumberTooLow(intUserNumber, intRandomNo)
Dim cGreetingMsg
IsTheNumberTooLow = False
cGreetingMsg = "Hello All"
If intUserNumber < intRandomNo Then
MsgBox "Your guess was too low. Try again", vbOKOnly, cGreetingMsg
IsTheNumberTooLow = True
End If
End Function发布于 2017-07-30 06:48:58
您是否在其他地方为cGreetingMsg赋值?和intUserNumber或intRandomNo
https://stackoverflow.com/questions/45394737
复制相似问题