|
Sub test1()
MsgBox "hello"
End Sub
Sub test2()
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = "Do you want to continue ?" '定义消息文本
Style = vbYesNo + vbCritical + vbDefaultButton2 ' 定义按钮
Title = "MsgBox Demonstration" ' 定义标题文本
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then ' 用户按下“是”
MyString = "你按下了是(Yes)" ' 完成某操作
Else ' 用户按下“否”
MyString = "你按下了否(No)" ' 完成某操作
End If
MsgBox MyString
End Sub
Sub test3()
If MsgBox("Continue?", vbYesNo) <> vbYes Then Exit Sub
MsgBox "你按下了yes,所以程序继续了,所以你就看这个提示信息了,如果你按了no,就退出程序了,看不到这句话了。"
End Sub
Sub test4()
MsgBox "This is the first line." & vbNewLine & "Second line." '分成多行显示
End Sub
Sub test5()
userinput = InputBox("输入字符:")
MsgBox userinput
End Sub
Sub test6()
userinput = InputBox("输入信息,你点“取消”就会退出程序")
If userinput = "" Then Exit Sub '加入这句话就不会报错,有时会报错
MsgBox userinput
End Sub |
|