猿问

VBA编程中MsgBox函数怎么用?

VBA编程中MsgBox函数怎么用


慕村9548890
浏览 926回答 4
4回答

holdtom

MsgBox(prompt[, buttons] [, title] [, helpfile, context])MsgBox 函数的语法具有以下几个命名参数:Prompt-------必需的。字符串表达式,作为显示在对话框中的消息。prompt 的最大长度大约为 1024 个字符,由所用字符的宽度决定。如果 prompt 的内容超过一行,则可以在每一行之间用回车符 (Chr(13))、换行符 (Chr(10)) 或是回车与换行符的组合 (Chr(13) & Chr(10)) 将各行分隔开来。Buttons-------可选的。数值表达式是值的总和,指定显示按钮的数目及形式,使用的图标样式,缺省按钮是什么以及消息框的强制回应等。如果省略,则 buttons 的缺省值为 0。Title-------可选的。在对话框标题栏中显示的字符串表达式。如果省略 title,则将应用程序名放在标题栏中。Helpfile--------可选的。字符串表达式,识别用来向对话框提供上下文相关帮助的帮助文件。如果提供了 helpfile,则也必须提供 context。Context-------可选的。数值表达式,由帮助文件的作者指定给适当的帮助主题的帮助上下文编号。如果提供了 context,则也必须提供 helpfile。

森林海

Displays a message in a dialog box, waits for the user to click a button, andreturns a value indicating which button the user clicked.MsgBox(prompt[, buttons][, title][, helpfile, context])ArgumentspromptString expression displayed as the message in the dialog box. The maximumlength of prompt is approximately 1024 characters, depending on the widthof the characters used. If prompt consists of more than one line, you canseparate the lines using a carriage return character (Chr(13)), alinefeed character (Chr(10)), or carriage return–linefeedcharacter combination (Chr(13) & Chr(10)) between eachline.buttonsNumeric expression that is the sum of values specifying the number and typeof buttons to display, the icon style to use, the identity of the defaultbutton, and the modality of the message box. See Settings section for values. Ifomitted, the default value for buttons is 0.titleString expression displayed in the title bar of the dialog box. If you omittitle, the application name is placed in the title bar.helpfileString expression that identifies the Help file to use to providecontext-sensitive Help for the dialog box. If helpfile is provided,context must also be provided. Not available on 16-bit platforms.contextNumeric expression that identifies the Help context number assigned by theHelp author to the appropriate Help topic. If context is provided,helpfile must also be provided. Not available on 16-bit platforms.
随时随地看视频慕课网APP
我要回答