VbScript(VBS)你好吗?

时间:2014-03-25 19:05:16

标签: windows vbscript

如何在VBS中发送消息?

错误讯息:

X = MsgBox(“Something,Happy Fools!”,0 + 16,“Ha!”)

该消息只是一个错误,任何人都可以回答这个问题吗?

2 个答案:

答案 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元素的列表。 enter image description here

答案 1 :(得分:0)

MsgBox方法正是您在VBScript中完成它的方法。使用以下任何一种语法:

msgbox "hello",16,"foo"

call msgbox("hello",16,"foo")