+ Reply to Thread
Results 1 to 10 of 10

Multiple lines desired in Msgbox

  1. #1
    Linking to specific cells in pivot table
    Guest

    Multiple lines desired in Msgbox

    Hi - I'm trying to have multiple lines of text appear in my message box but
    can't figure out how to do this. Basically, I'd like my Msgbox to display,
    for example, the following text:

    "Hi! Thanks for using this spreadsheet.
    My name is Rob and I hope you find this useful.
    Please contact me if you have any problems!"

    Basically, I literally want to have this on three lines. Currently I have
    the following code but can't figure out how to get this message on three
    lines. I've tried to insert chr(13), hoping that would move the desired text
    to the next line, but I haven't been able to figure out the proper syntax.
    Thx!

    MsgBox "Hi! Thanks for using this spreadsheet. My name is Rob and I hope
    you find this useful. Please contact me if you have any problems!"




  2. #2
    Harald Staff
    Guest

    Re: Multiple lines desired in Msgbox

    MsgBox "Hi! Thanks for using this spreadsheet." & VbNewLine & _
    "My name is Rob and I hope you find this useful." & VbNewLine & _
    "Please contact me if you have any problems!"

    HTH. Best wishes Harald

    "Linking to specific cells in pivot table"
    <[email protected]> skrev i
    melding news:[email protected]...
    > Hi - I'm trying to have multiple lines of text appear in my message box

    but
    > can't figure out how to do this. Basically, I'd like my Msgbox to

    display,
    > for example, the following text:
    >
    > "Hi! Thanks for using this spreadsheet.
    > My name is Rob and I hope you find this useful.
    > Please contact me if you have any problems!"
    >
    > Basically, I literally want to have this on three lines. Currently I have
    > the following code but can't figure out how to get this message on three
    > lines. I've tried to insert chr(13), hoping that would move the desired

    text
    > to the next line, but I haven't been able to figure out the proper syntax.
    > Thx!
    >
    > MsgBox "Hi! Thanks for using this spreadsheet. My name is Rob and I hope
    > you find this useful. Please contact me if you have any problems!"
    >
    >
    >




  3. #3
    William Benson
    Guest

    Re: Multiple lines desired in Msgbox

    I find CHR(13) works beautifully too -- I have never seen it fail to drop a
    line. Has anyone seen it not work?


    "Harald Staff" <[email protected]> wrote in message
    news:[email protected]...
    > MsgBox "Hi! Thanks for using this spreadsheet." & VbNewLine & _
    > "My name is Rob and I hope you find this useful." & VbNewLine & _
    > "Please contact me if you have any problems!"
    >
    > HTH. Best wishes Harald
    >
    > "Linking to specific cells in pivot table"
    > <[email protected]> skrev i
    > melding news:[email protected]...
    >> Hi - I'm trying to have multiple lines of text appear in my message box

    > but
    >> can't figure out how to do this. Basically, I'd like my Msgbox to

    > display,
    >> for example, the following text:
    >>
    >> "Hi! Thanks for using this spreadsheet.
    >> My name is Rob and I hope you find this useful.
    >> Please contact me if you have any problems!"
    >>
    >> Basically, I literally want to have this on three lines. Currently I
    >> have
    >> the following code but can't figure out how to get this message on three
    >> lines. I've tried to insert chr(13), hoping that would move the desired

    > text
    >> to the next line, but I haven't been able to figure out the proper
    >> syntax.
    >> Thx!
    >>
    >> MsgBox "Hi! Thanks for using this spreadsheet. My name is Rob and I
    >> hope
    >> you find this useful. Please contact me if you have any problems!"
    >>
    >>
    >>

    >
    >




  4. #4
    Nick Hebb
    Guest

    Re: Multiple lines desired in Msgbox

    This is slightly off topic, but if you ever want to wrap text in a
    cell, use VbLf to pick the exact position where you want the line
    break. Using VbNewLine or VbCrLf will insert the line break but also
    display a little black square. I only mention it because I wasted
    longer than I want to admit trying to figure that out one day.


  5. #5
    Nick Hebb
    Guest

    Re: Multiple lines desired in Msgbox

    William,

    This gives a pretty good overview of all your options:
    http://support.microsoft.com/?kbid=211774


  6. #6
    William Benson
    Guest

    Re: Multiple lines desired in Msgbox

    Thanks Nick ...
    The list there says

    vbNewLine A platform-specific new line character, either [Chr(13) +
    Chr(10)] or [Chr(13)]

    so ... are there platforms where the former is required? I have never used
    chr(10).


    "Nick Hebb" <[email protected]> wrote in message
    news:[email protected]...
    > William,
    >
    > This gives a pretty good overview of all your options:
    > http://support.microsoft.com/?kbid=211774
    >




  7. #7
    Nick Hebb
    Guest

    Re: Multiple lines desired in Msgbox

    On Windows VbCrLf is equivalent to VbNewLine, so every time that you've
    used either one you've implicitly used chr(10) - line feed.

    I imagine that the other systems that use only chr(13) - carraige
    return - would primarily be Macs.


  8. #8
    William Benson
    Guest

    Re: Multiple lines desired in Msgbox

    Nick, my point is that I only, ever, use Chr(13) and it always pops me down
    to the next line. Every time.

    So, I am asking if there are systems which REQUIRE chr(10) to add a line,
    because I have found no Windows apps ever do.

    In other words, VBCRLF and Chr(13) do the same thing in a message box, a
    list box, etc.

    From my experience anyway.

    "Nick Hebb" <[email protected]> wrote in message
    news:[email protected]...
    > On Windows VbCrLf is equivalent to VbNewLine, so every time that you've
    > used either one you've implicitly used chr(10) - line feed.
    >
    > I imagine that the other systems that use only chr(13) - carraige
    > return - would primarily be Macs.
    >




  9. #9
    Tom Ogilvy
    Guest

    Re: Multiple lines desired in Msgbox

    > So, I am asking if there are systems which REQUIRE chr(10) to add a line,

    In a msgbox where Excel is supported, I doubt it. All these work:
    (comment out all but the one to test)

    Sub aa()
    a = Chr(10)
    a = Chr(13)
    a = vbLf ' chr(10)
    a = vbCrLf ' chr(13) & chr(10)
    a = vbCr ' chr(13)
    a = vbNewLine
    MsgBox "abcdefg" & a & "hijklmnop"
    End Sub

    I am not aware of a Unix version of Excel, so I think it only supports
    Windows and MAC. There was a version that supported a RISC processor
    (forget which one), but that was back around the Excel 5 time frame I
    believe.

    However, for DOS (and I assume windows) at least, the line termination
    character is defined to be CrLf. I know Unix only uses one, I believe
    chr(10) and MAC only uses one (chr(13)).

    for cross system support, I would imagine most modern software does not
    strictly require both CrLf for text files.

    --
    Regards,
    Tom Ogilvy


    "William Benson" <[email protected]> wrote in message
    news:u%[email protected]...
    > Nick, my point is that I only, ever, use Chr(13) and it always pops me

    down
    > to the next line. Every time.
    >
    > So, I am asking if there are systems which REQUIRE chr(10) to add a line,
    > because I have found no Windows apps ever do.
    >
    > In other words, VBCRLF and Chr(13) do the same thing in a message box, a
    > list box, etc.
    >
    > From my experience anyway.
    >
    > "Nick Hebb" <[email protected]> wrote in message
    > news:[email protected]...
    > > On Windows VbCrLf is equivalent to VbNewLine, so every time that you've
    > > used either one you've implicitly used chr(10) - line feed.
    > >
    > > I imagine that the other systems that use only chr(13) - carraige
    > > return - would primarily be Macs.
    > >

    >
    >




  10. #10
    William Benson
    Guest

    Re: Multiple lines desired in Msgbox

    I learn something from you every time I read your posts Tom, you go above
    and beyond ... pls keep going!!!!!!!!!
    "Tom Ogilvy" <[email protected]> wrote in message
    news:[email protected]...
    >> So, I am asking if there are systems which REQUIRE chr(10) to add a line,

    >
    > In a msgbox where Excel is supported, I doubt it. All these work:
    > (comment out all but the one to test)
    >
    > Sub aa()
    > a = Chr(10)
    > a = Chr(13)
    > a = vbLf ' chr(10)
    > a = vbCrLf ' chr(13) & chr(10)
    > a = vbCr ' chr(13)
    > a = vbNewLine
    > MsgBox "abcdefg" & a & "hijklmnop"
    > End Sub
    >
    > I am not aware of a Unix version of Excel, so I think it only supports
    > Windows and MAC. There was a version that supported a RISC processor
    > (forget which one), but that was back around the Excel 5 time frame I
    > believe.
    >
    > However, for DOS (and I assume windows) at least, the line termination
    > character is defined to be CrLf. I know Unix only uses one, I believe
    > chr(10) and MAC only uses one (chr(13)).
    >
    > for cross system support, I would imagine most modern software does not
    > strictly require both CrLf for text files.
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    > "William Benson" <[email protected]> wrote in message
    > news:u%[email protected]...
    >> Nick, my point is that I only, ever, use Chr(13) and it always pops me

    > down
    >> to the next line. Every time.
    >>
    >> So, I am asking if there are systems which REQUIRE chr(10) to add a line,
    >> because I have found no Windows apps ever do.
    >>
    >> In other words, VBCRLF and Chr(13) do the same thing in a message box, a
    >> list box, etc.
    >>
    >> From my experience anyway.
    >>
    >> "Nick Hebb" <[email protected]> wrote in message
    >> news:[email protected]...
    >> > On Windows VbCrLf is equivalent to VbNewLine, so every time that you've
    >> > used either one you've implicitly used chr(10) - line feed.
    >> >
    >> > I imagine that the other systems that use only chr(13) - carraige
    >> > return - would primarily be Macs.
    >> >

    >>
    >>

    >
    >




+ 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