ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Multiple Lines in Message Boxes (https://www.excelbanter.com/excel-programming/377351-re-multiple-lines-message-boxes.html)

NickHK

Multiple Lines in Message Boxes
 
Mike,
If you are concerned about a Mac (or some other platform), vbNewLine is the
way to go, because it evaluates to what the system expects .
So on Windows it is vbCrLf but (apparently) vbCr on a Mac.
But it will be correct on either.

NickHK

"Mike Woodhouse" wrote in message
ups.com...


On Nov 14, 4:31 am, "NickHK" wrote:
Msg = "Step 1: do this" & vbNewLine & "Step 2: do that"
MsgBox Msg

NickHK

"amacdoc" wrote in

...

Can anyone tell me how to get multiple lines in the prompt section of

Message
boxes?
VB help mentions carriage return characters chr(13) but i cant work

out
how
to use them.
Currently i have a line of code that says:
Msg = Step 1: do this, Step 2: do that
i am trying to get step 1 and step 2 on different lines


All these seem to work. If you're on a Mac, or remotely concerned about
Mac compatibility, it looks like vbNewLine is the way to go...

Public Sub MsgBoxes()

MsgBox "a" & Chr(13) & "b"
MsgBox "a" & Chr(10) & "b"
MsgBox "a" & vbCrLf & "b"
MsgBox "a" & vbCr & "b"
MsgBox "a" & vbLf & "b"
MsgBox "a" & vbNewLine & "b" ' Same as vbCrLf on Windows (13+10)
but just Chr(13) on Mac

End Sub


Mike





All times are GMT +1. The time now is 10:29 AM.

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