+ Reply to Thread
Results 1 to 4 of 4

Thread: How do I format the text in a message box?

  1. #1
    Registered User
    Join Date
    04-26-2010
    Location
    Houston, TX
    MS-Off Ver
    Excel 2003
    Posts
    1

    Red face How do I format the text in a message box?

    The code below builds a message string that is then feed to a message box if it contains information on an error. The message string is a dynamic list of units and the number of missing months of data each has in a SQL based data download. Everything works except the column of the number of missing months of data does not line up. I suspect there is nothing wrong with my logic, I just need to switch the text in the message box to a non-proportionally spaced font or use some other technique to get it to line up. I'm brain dead at this point. Help!
    ' Create data integrity check results message.
        dblRow = 6
        strDICResults = "The following units are missing data." & vbCrLf & vbCrLf & "Unit           Months Of Missing Data" & vbCrLf
        With Worksheets("Input")
            Do
                If .Cells(dblRow, 9).Value <> 0 Then
                    strDICResults = strDICResults _
                        & vbCrLf _
                        & .Cells(dblRow, 4).Value _
                        & String(25 - Len(.Cells(dblRow, 4).Value), ".") _
                        & .Cells(dblRow, 9).Value
                End If
                dblRow = dblRow + 1
            Loop While Len(.Cells(dblRow, 4).Value) > 0
        End With
        strDICResults = strDICResults & vbCrLf & vbCrLf & "Do you wish to proceed anyway?"
        
        ' Display data integrity check results message.
        If Len(strDICResults) > 77 Then
            vntResponse = MsgBox(strDICResults, vbYesNo + vbCritical, "Error Message")
        End If
        If vntResponse = 7 Then GoTo Errorhandler1a
    Last edited by royUK; 04-26-2010 at 03:16 PM. Reason: add code tags

  2. #2
    Forum Guru, retired Admin royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    25,639

    Re: How do I format the text in a message box?

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

    Added this time only
    Hope that helps.

    RoyUK
    --------
    If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need

    For Excel Tips & Solutions, free examples and tutorials why not check out my downloads

    New members please read & follow the Forum Rules

    Remember to mark your questions Solved and rate the answer(s)

  3. #3
    Forum Guru, retired Admin royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    25,639

    Re: How do I format the text in a message box?

    I don't think that you can format the text in a message box,maybe design a userform
    Hope that helps.

    RoyUK
    --------
    If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need

    For Excel Tips & Solutions, free examples and tutorials why not check out my downloads

    New members please read & follow the Forum Rules

    Remember to mark your questions Solved and rate the answer(s)

  4. #4
    Forum Guru shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2007, 2010
    Posts
    25,777

    Re: How do I format the text in a message box?

    You can change it in Control Panel to a fixed-pitch font, but it will effect other applications as well.

    I agree with Roy -- make a simple userform.
    Microsoft MVP - Excel
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

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