Microsoft KB Archive/81788

{|
 * width="100%"|

WD: Using MsgBox Statement to Display Multiple Lines of Text

 * }

Q81788

-

The information in this article applies to:


 * Microsoft Word for Windows, versions 1.0, 1.1, 1.1a, 2.0, 2.0a, 2.0a-CD, 2.0b, 2.0c, 6.0, 6.0a, 6.0c
 * Microsoft Word for Windows, versions 7.0, 7.0a
 * Microsoft Word for the Macintosh, versions 6.0, 6.0.1, 6.0.1a

-

SUMMARY
In 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 INFORMATION
To post more than one line of information, you use character 13 or &quot;Chr$(13)&quot;, 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) + strBlue Assuming 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

Blue If 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 &quot;Line One of the message box.&quot; + Chr$(13) + &quot;Line Two.&quot; This macro command results in a message box that displays the following lines of text:

Line One of the message box.

Line Two.