2014-03-25 29 views
-1

你如何在VBS中留言?VbScript(VBS)你好吗?

错误消息:

X = MSGBOX( “!事情,开心阿斗”,0 + 16, “哈!”)

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

+2

当然,这将通过显示您可以轻松找到自己的示例和文档链接来回答。这浪费了我们的时间,伙计们。 – TheBlastOne

回答

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

+0

这是Visual Basic,我正在使用VBScript! (.vbs) –

+0

Nah这是vbscript,vba和visual basic。 – Rich

+0

把它放在记事本中,并将其保存为something.vbs并查看它是否有效。 –

0

的MSGBOX方法恰恰是你如何完成它在VBScript。使用这两种语法品种:

msgbox "hello",16,"foo" 

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

我正在使用VBScript! –

+0

您是否意识到VBS代表“Visual Basic Sc​​ript?”?如在VBS中? –

相关问题