clsc.net
MsgBox line break codes - clsc.net

MsgBox line break codes

When using VBA pop-up messages (“MsgBoxes”), usability will improve by writing better text than “Critical Error: Restart” or other such nonsense. Often better descriptions equal more text in the MsgBox.

Enter line breaks to make the extra text more readable and hence raising usability a notch more. Here are the codes you need: 

Character combination Shorthand Description
Chr(13) + Chr(10) vbCrLf or vbNewLine Line break: Carriage return–linefeed combination
Chr(13) vbCr Carriage return character
Chr(10) vbLf Linefeed character

The last two, “Carriage return” and “Linefeed” by themselves are only relevant on… typewriters. Which is an unlikely vehicle for running VBA code, but apparently Microsoft don’t think so.

Tags: , , , ,

Leave a comment




 
 
 
 
 
 
clsc.net | © clsc.net | If it’s complicated, just call me. | Log in
2010.09.0302:50