ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA msgbox function (https://www.excelbanter.com/excel-programming/328942-vba-msgbox-function.html)

LesLdh

VBA msgbox function
 
I want to have a msgbox prompt that has two lines of text, eg:

MsgBox("This is the first line
this is the second line")

I understand that I have to use a carriage return character, but can't seem
to get the syntax right. Can anybody help?

Les.

Vasant Nanavati

VBA msgbox function
 
MsgBox "First line" & vbNewLine & "Second line"

--

Vasant


"LesLdh" wrote in message
...
I want to have a msgbox prompt that has two lines of text, eg:

MsgBox("This is the first line
this is the second line")

I understand that I have to use a carriage return character, but can't

seem
to get the syntax right. Can anybody help?

Les.




Nick Hodge

VBA msgbox function
 
Les

Msgbox "This is the first line"&Chr(13)&"This is the second"

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS

"LesLdh" wrote in message
...
I want to have a msgbox prompt that has two lines of text, eg:

MsgBox("This is the first line
this is the second line")

I understand that I have to use a carriage return character, but can't
seem
to get the syntax right. Can anybody help?

Les.




Alan Perkins[_3_]

VBA msgbox function
 
Try this:

MsgBox("This is the first line" & vbCrLf & "this is the second line")

HTH

Alan P.

"LesLdh" wrote in message
...
I want to have a msgbox prompt that has two lines of text, eg:

MsgBox("This is the first line
this is the second line")

I understand that I have to use a carriage return character, but can't
seem
to get the syntax right. Can anybody help?

Les.





All times are GMT +1. The time now is 01:43 PM.

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