+ Reply to Thread
Results 1 to 6 of 6

General Message Box Question

  1. #1
    Forum Contributor
    Join Date
    05-09-2005
    Location
    SC
    Posts
    196

    General Message Box Question

    Whenever you prompt a message box, using this format:

    returnvalue = MsgBox("Did you remember to log in your name?",64,"Message")

    If I had a long statement or wanted to add a second sentence, is it possible
    (or how do you), continue or put the second sentenceon another line?

    Or does excel just place everything on one line?

    Thanks,
    EMoe

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good evening Emoe

    There are two ways of doing it, both demostrated in this macro. Take your pick.

    Sub example()
    MsgBox "This is line 1" & vbLf & "This is line 2" _
    & Chr(13) & "This is line 3"
    End Sub

    HTH

    DominicB

  3. #3
    Forum Contributor
    Join Date
    05-09-2005
    Location
    SC
    Posts
    196
    It works!!! Thanks a bunch.

    Regards,
    EMoe

  4. #4
    Tom Ogilvy
    Guest

    Re: General Message Box Question

    Sub a()
    msg = "line1" & vbNewLine & "Line2"
    returnvalue = MsgBox(msg, 64, "title")
    End Sub


    --
    Regards,
    Tom Ogilvy




    "EMoe" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Whenever you prompt a message box, using this format:
    >
    > returnvalue = MsgBox("Did you remember to log in your
    > name?",64,"Message")
    >
    > If I had a long statement or wanted to add a second sentence, is it
    > possible
    > (or how do you), continue or put the second sentenceon another line?
    >
    > Or does excel just place everything on one line?
    >
    > Thanks,
    > EMoe
    >
    >
    > --
    > EMoe
    > ------------------------------------------------------------------------
    > EMoe's Profile:

    http://www.excelforum.com/member.php...o&userid=23183
    > View this thread: http://www.excelforum.com/showthread...hreadid=374589
    >




  5. #5
    Chip Pearson
    Guest

    Re: General Message Box Question

    Use vbNewLine to break text up in to multiple lines. E.g.,

    MsgBox "Line one" & vbNewLine & "Line two"


    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com




    "EMoe" <[email protected]> wrote
    in message
    news:[email protected]...
    >
    > Whenever you prompt a message box, using this format:
    >
    > returnvalue = MsgBox("Did you remember to log in your
    > name?",64,"Message")
    >
    > If I had a long statement or wanted to add a second sentence,
    > is it
    > possible
    > (or how do you), continue or put the second sentenceon another
    > line?
    >
    > Or does excel just place everything on one line?
    >
    > Thanks,
    > EMoe
    >
    >
    > --
    > EMoe
    > ------------------------------------------------------------------------
    > EMoe's Profile:
    > http://www.excelforum.com/member.php...o&userid=23183
    > View this thread:
    > http://www.excelforum.com/showthread...hreadid=374589
    >




  6. #6
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Hi Emoe

    No problem, I appreciate the feedback.

    However, it seem that our questions posts are now duplicated on the Microsoft site, but (judging from the response) not the answers posted!

    DominicB

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1