ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   msgbox Question (https://www.excelbanter.com/excel-programming/343823-msgbox-question.html)

dok112[_53_]

msgbox Question
 

I am having a serious lapse of knowledge right now...

How do I make a msgbox have multiple lines of text instead of one
ongoing line.

ex.
msg = "Q1: ------------------------------" & _
"Q2: ------------------------------"
style = vbokonly
title = Test"

msgbox msg, style, title

When I do this, I get Q1: ----------------- Q2:---------------- and I
need them on 2 lines.


--
dok112
------------------------------------------------------------------------
dok112's Profile: http://www.excelforum.com/member.php...o&userid=10581
View this thread: http://www.excelforum.com/showthread...hreadid=479281


JakeyC

msgbox Question
 
Use the concatenate operator '&' to include Chr(10) in your string of
text.

ie MsgBox ("Hello there" & Chr(10) & "How are you")
should display:

Hello there
How are you

Chr(10) works a little like someone having pressed Return mid-sentence.


Leith Ross[_116_]

msgbox Question
 

Hello Dok112,

Add a Carraige Return Line Feed to the end of of line to start a new
one...

msg = "Q1: ------------------------------" & vbCrLf & _
"Q2: ------------------------------"
style = vbokonly
title = Test"


This will give you 2 lines.

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=479281



All times are GMT +1. The time now is 07:31 PM.

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