如何在VBS中发送消息?
错误讯息:
X = MsgBox(“Something,Happy Fools!”,0 + 16,“Ha!”)
该消息只是一个错误,任何人都可以回答这个问题吗?
答案 0 :(得分:1)
那里有很多msgbox类型....
以下是一些链接:
1: VBA Message Box (msgbox) – The Message Can Do Better
2: VBA Message Box Function
3: VBScript Message Box Function
以下是语法:
Syntax
MsgBox(prompt[, buttons] [, title] [, helpfile, context])
以下是一些例子:
'basic
Sub basic_messagebox()
MsgBox "Hi there"
End Sub
'Abort/Retry/Ignore - returns integer according to user entry.
Sub basic_messagebox()
i = MsgBox("Do you wish to be terminated ?", vbAbortRetryIgnore, "Greetings Earthlings", "test.hlp", 100)
End Sub
'Yes No msgbox
Sub YesNo_msgbox
intAnswer = Msgbox("Do you want to delete these files?", vbYesNo, "Delete Files")
If intAnswer = vbYes Then
Msgbox "You answered yes."
Else
Msgbox "You answered no."
End If
End Sub
'You can incrementally add on different vbelements to build the msgbox construct
Sub basic_messagebox()
i = MsgBox("Hi there", vbOKOnly + vbCritical)
End Sub
这是msgbox中接受的vb元素的列表。
答案 1 :(得分:0)
MsgBox方法正是您在VBScript中完成它的方法。使用以下任何一种语法:
msgbox "hello",16,"foo"
或
call msgbox("hello",16,"foo")