+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    07-10-2008
    Location
    Chicago
    Posts
    10

    Two lines in a msg box on open?

    I need a msg to pop up when a worksheet opens. Pretty simple:

    Private Sub Workbook_Open()
    If MsgBox("My msg goes here!") Then
    Exit Sub
    End If
    End Sub


    But I need to be able to have multiple lines, maybe a short paragraph.
    How do you get it to allow additional lines?

    Thanks!
    Last edited by jzibton; 06-21-2009 at 01:25 PM.

  2. #2
    Forum Guru martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    10,477

    Re: Two lines in a msg box on open?

    this is how you add lines
    Code:
    Sub test()
    
    MsgBox "My msg goes here!" & vbCrLf & "this is second line"
    End Sub
    Mojito connoisseur and a dabbler in Cisco
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Forum Guru
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2003, 2007.
    Posts
    1,413

    Re: Two lines in a msg box on open?

    jzibton,

    Try:

    Code:
    Sub TestMessage()
    
    MsgBox "I need a msg to pop up when a worksheet opens. Pretty simple:" & vbCrLf & vbCrLf & _
      "But I need to be able to have multiple lines, maybe a short paragraph." & vbCrLf & vbCrLf & _
      "How do you get it to allow additional lines?"
    
    End Sub

    It will create a three line message with double spacing.
    Have a great day,
    Stan
    stanleydgromjr
    Windows Vista Business, Excel 2003 and 2007

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  4. #4
    Forum Guru mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,984

    Re: Two lines in a msg box on open?

    jzibton

    Please take a couple of minutes and read ALL theForum Rules then wrap your VBA code (Rule 3)
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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.2.0