MsgBox Question

  • Thread starter Thread starter Joe Williams
  • Start date Start date
J

Joe Williams

I understand how to format a simple msgbox,as in msgbox("Hello World") but
how do you add a seond line to the msgbox, so that it displays Hello on one
line, world on the next, and then the ok button below that?

Thanks
 
MsgBox "Hello" & vbCrLf & "World"

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
Joe Williams said:
I understand how to format a simple msgbox,as in msgbox("Hello World") but
how do you add a seond line to the msgbox, so that it displays Hello on one
line, world on the next, and then the ok button below that?

MsgBox "This is line 1" & vbCrLf & "This is Line 2"

Unlike most Access controls the MsgBox actually only needs the LineFeed OR
the Carriage Return, but I like to be consistent. You could also use...

MsgBox "This is line 1" & vbLf & "This is Line 2"
MsgBox "This is line 1" & vbCr & "This is Line 2"
MsgBox "This is line 1" & vbNewLine & "This is Line 2"
MsgBox "This is line 1" & Chr(13) & Chr(10) & "This is Line 2"
MsgBox "This is line 1" & Chr(10) & "This is Line 2"
MsgBox "This is line 1" & Chr(13) & "This is Line 2"
 
MsgBox "This is line 1" & vbLf & "This is Line 2"
MsgBox "This is line 1" & vbCr & "This is Line 2"
MsgBox "This is line 1" & vbNewLine & "This is Line 2"
MsgBox "This is line 1" & Chr(13) & Chr(10) & "This is Line 2"
MsgBox "This is line 1" & Chr(10) & "This is Line 2"
MsgBox "This is line 1" & Chr(13) & "This is Line 2"

or
MsgBox "This is line 1" & vbLf
MsgBox = MsgBox & "This is Line 2" & vbLf
MsgBox = MsgBox & "This is Line 3"

etc
 
or
MsgBox "This is line 1" & vbLf
MsgBox = MsgBox & "This is Line 2" & vbLf
MsgBox = MsgBox & "This is Line 3"

or

MsgBox "This is line 1" & vbCrLf & _
"This is line 2" & vbCrLf & _
"This is line 3"
 
Back
Top