Results 1 to 4 of 4

Thread: msgbox (VB)

  1. #1
    2 Star Lounger
    Join Date
    Jun 2002
    Posts
    122
    Thanks
    1
    Thanked 0 Times in 0 Posts

    msgbox (VB)

    Hi,

    I need to add text to a msgbox laid out as follows:

    "A copy of this letter must be kept on the appropriate records file for your team:

    Team 1 Glasgow - File A
    Team 2 Edinburgh - File B
    Team 3 London - File C"

    Can anyone tell me how to take a new line in the middle of the msgbox text please?

    Thanks!

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: msgbox (VB)

    Hi,
    You can use vbCrLf to do this - e.g.:
    <code>msgbox "Hello" & vbCrLf & "Violet"</code>
    HTH.
    Regards,
    Rory

    Microsoft MVP - Excel

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: msgbox (VB)

    You can concatenate with vbCrLf:

    Dim strMsg As String

    strMsg = "A copy of this letter must be kept on the appropriate records file for your team:" & _
    vbCrLf & vbCrLf & "Team 1 Glasgow - File A" & _
    vbCrLf & "Team 2 Edinburgh - File B" & _
    vbCrLf & "Team 3 London - File C"

    MsgBox strMsg, vbInformation

  4. #4
    2 Star Lounger
    Join Date
    Jun 2002
    Posts
    122
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: msgbox (VB)

    Thanks Rory and Hans!

Posting Permissions

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