ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   MsgBox line break (https://www.excelbanter.com/excel-discussion-misc-queries/160719-msgbox-line-break.html)

Horatio J. Bilge, Jr.

MsgBox line break
 
I would like to add a line break to a message box. The VBA help file for
MsgBox says you can use a carriage return character (CHR(13)) or linefeed
character (Chr(10)), but I can't figure out how to use them.

What I have is something like this:

MsgBox("This is line #1"Chr(13)"This is line #2")

but this give me an error "Compile error: Syntax error"

Thanks for any help,
~ Horatio

Dave Peterson

MsgBox line break
 
MsgBox "This is line #1" & vblf & "This is line #2"
or
MsgBox "This is line #1" & chr(10) & "This is line #2"
or
MsgBox "This is line #1" & vbnewline & "This is line #2"



Horatio J. Bilge, Jr. wrote:

I would like to add a line break to a message box. The VBA help file for
MsgBox says you can use a carriage return character (CHR(13)) or linefeed
character (Chr(10)), but I can't figure out how to use them.

What I have is something like this:

MsgBox("This is line #1"Chr(13)"This is line #2")

but this give me an error "Compile error: Syntax error"

Thanks for any help,
~ Horatio


--

Dave Peterson

Horatio J. Bilge, Jr.

MsgBox line break
 
Thank you.

"Dave Peterson" wrote:

MsgBox "This is line #1" & vblf & "This is line #2"
or
MsgBox "This is line #1" & chr(10) & "This is line #2"
or
MsgBox "This is line #1" & vbnewline & "This is line #2"



Horatio J. Bilge, Jr. wrote:

I would like to add a line break to a message box. The VBA help file for
MsgBox says you can use a carriage return character (CHR(13)) or linefeed
character (Chr(10)), but I can't figure out how to use them.

What I have is something like this:

MsgBox("This is line #1"Chr(13)"This is line #2")

but this give me an error "Compile error: Syntax error"

Thanks for any help,
~ Horatio


--

Dave Peterson



All times are GMT +1. The time now is 02:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com