Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

carriage return in msgbox

Status
Not open for further replies.

Luis939

MIS
Feb 28, 2003
453
US
i tried using char(13) for a carriage return in my msg box but it doesnt work, i tried
dim mychar
mychar = chr(13)
like the help file says and nothing, how would i write one line (carriage return) and then the next line underneath it, thanks!
 

Dim MyChar

MyChar = Chr(10) & Chr(13)

or you can use the constants
[tt]
vbNewLine
vbCrLf
vbCr
vbLf
[/tt]

Good Luck

 
no its not working for me, i dont think im using anythign right
im using
im myChar
myChar = Chr(13)

MsgBox ("TEXTTTTTTTTTTTTT mychar textttttttttt vbnewline texttttttttttttttt")

its not working, am i using it right, thanks!
 
well i tried this and it worked (from help file)

Dim a
a = "text1"
Dim b
b = "text2"
Dim myChar
myChar = Chr(13)
MsgBox (a + myChar + b)

and it worked, but does anyone think there is a much simpler way??
 
well i just found these 2 different ways, i guess you cant get simpler than that

Let myChar = Chr(13)
MsgBox ("text1" + Chr(13) + "text2")

or

Let myChar = Chr(13)
MsgBox ("text1" & Chr(13) & "text2")
 
Why bother dimming anything
The easiest way is:

Msgbox "this goes on the 1st line" & vbcrlf & this goes on the 2nd line Rgds
Geoff
"Some cause happiness wherever they go; others whenever they go."
-Oscar Wilde
 
ohh ok, because I tried doin that but without the &, and i woudlnt understand why it woudlnt work, so thanks alot!!
 
Just to clarify for you, the carriage return is a character in itself.

So what you are doing is concatenating strings - hence the need for "&" - or you can use "+" if you prefer - it has the same functionality.
 
oh ok, i never realized it was a character itself, that makes more sense now, thanks alot!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top