Is Multi line possible with MsgBox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to have this in multiple lines, instead of just one single line?

MsgBox "An Error as occurred in the Save file to folder. This Macro will now
TERMINATED"
 
Is it possible to have this in multiple lines, instead of just one single line?

MsgBox "An Error as occurred in the Save file to folder. This Macro will now
TERMINATED"

The string chr(13) will provide a carriage return. For example

MsgBox "An Error as occurred in the Save file to folder." & chr(13) &
"This Macro will now
TERMINATED"
 
Try

MsgBox "Line One" & vbCrLf & _
"Line Two"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)
 
Is it possible to have this in multiple lines, instead of just one single
The string chr(13) will provide a carriage return. For example

MsgBox "An Error as occurred in the Save file to folder." & chr(13) &
"This Macro will now
TERMINATED"

Or, you can use the built-in VB constant for carriage returns, vbCr...

MsgBox "An Error as occurred in the Save file to folder." & vbCr & "This
Macro will now TERMINATED"

If you want a blank line between the sentences for visual looks reasons, use
two vbCr characters...

MsgBox "An Error as occurred in the Save file to folder." & vbCr & vbCr &
"This Macro will now TERMINATED"

Note: I'm sure your newsreader will split the above lines into more than one
line, but they are just single code lines.

Rick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top