1、MsgBox函数可用于在对话框中显示信息。一旦显示出来,消息框将一直保持,直至用户单击某个按钮为止。根据用户单击的按钮,会返回不同的整数值。
MsgBox函数的语法如下:
MsgBox(prompt[,buttons][,title][, helpfile, context])
无返回值:
MsgBox "Do you wish to save the changes to'"&_
ThisWorkbook.Name&"'",vbYesNoCancel+vbExclamation
有返回值:
Dim iResponse As Integer
IResponse=MsgBox("Do you wish to save the changes to'"&_
ThisWorkbook.Name&"'",vbYesNoCancel+vbExclamation)
2、下面是msgbox的buttons参数,从各组数值中只能选择一个。

3、MsgBox函数的返回值完全取决于用户所选择的按钮。
