WD: Using MsgBox Statement to Display Multiple Lines of TextLast reviewed: February 11, 1998Article ID: Q81788 |
The information in this article applies to:
SUMMARYIn Microsoft Word, you can use the MsgBox command to post a message or the value of a variable. This article discusses how to display more than one line of text within a message box.
MORE INFORMATIONTo post more than one line of information, you use character 13 or "Chr$(13)", to insert a paragraph mark within the message box. The following macro command posts the contents of the variables strRed, strGreen and strBlue on separate lines of a message box:
MsgBox strRed + Chr$(13) + strGreen + Chr$(13) + strBlueAssuming the contents of the variables equate to Red, Green, and Blue, the above macro command results in a message box that displays the following lines of text:
Red Green BlueIf the text you want to display is of numeric value, you can use the Str$() function to return the string representation. For example, the following macro posts the numbers 1 and 2, on seperate lines, in a message box:
MsgBox Str$(1) + Chr$(13) + Str$(2)The following macro command demonstrates the use of character 13 to display two lines of literal text in a message box:
MsgBox "Line One of the message box." + Chr$(13) + "Line Two."This macro command results in a message box that displays the following lines of text:
Line One of the message box. Line Two. REFERENCES"Using WordBasic," by WexTech Systems and Microsoft, page 257
|
Additional query words: new line Chr$ MsgBox message box
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |