Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Msgbox

Status
Not open for further replies.

PB90

Technical User
Jul 11, 2005
65
0
0
US
I would like to use Msgbox to display some information. The catch is, I want it broken down by specific lines. How would I insert a carriage Return/Linefeed into the Msgbox.

What I currently have:
MsgBox "Request Added.", vbOKOnly + vbInformation, "Record Added
 
carriage return is either chr(10) or chr(13). Just concatenate the function to your string like so:

"Hello" & chr(10) & "How are you?
 
or

vbcr for carrage return
vblf for line feed and
vbcrlf for both of then


Ian M (UK)

Program Error
Programmers do it one finger at a time!
 
PS
thats instead of chr(10) it makes it easier to understand and dont forget to put the & before and after it.

Program Error
Programmers do it one finger at a time!
 
How are ya PB90 . . . . .

Perhaps an example:
Code:
[blue]   Dim NL As String, DL As String, Msg As String
   
   NL = vbNewLine [green]'New Line[/green]
   DL = NL & NL   [green]'Double Line[/green]
   
   Msg = "1st Line" & NL & _
         "2nd Line" & DL & _
         "3rd Line"
   MsgBox Msg[/blue]
The msgbox would look like this:
[blue]1st Line
2nd Line

3rd Line[/blue]

Calvin.gif
See Ya! . . . . . .
 
Thank you BarrySprout, ProgramError & AceMan1,

That makes it much clearer. I especially like your explanation AceMan1. That shows exactly what I was looking for.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top