Consulting

Results 1 to 3 of 3

Thread: Solved: Columns in MsgBox

  1. #1

    Solved: Columns in MsgBox

    Hi all,

    I know how to make lines in a MsgBox.
    IE:
    [VBA]Sub example3()
    MsgBox "This is example 3" & vbLf & "This is line 2" _
    & Chr(13) & "This is line 3"
    End Sub[/VBA]Question: Is there a way to make Columns??
    Thx
    Dave
    "The game is afoot Watson"

  2. #2
    VBAX Regular
    Joined
    May 2004
    Location
    Adelaide, Australia
    Posts
    28
    Location
    Not sure exactly what you mean, but using a user-defined data type to impliment some padding to space our columns. Alter the column widths for A,B,C from 20 to suit.[vba]Option Explicit

    Type Pad
    a As String * 20
    B As String * 20
    C As String * 20
    End Type

    Sub MsgBoxCols()
    Dim p As Pad, i As Long, s As String

    With p
    For i = 1 To 5
    .a = "ColA line" & i
    .B = "ColB line" & i
    .C = "ColC line" & i
    s = s & .a & .B & .C & vbLf
    Next
    End With

    MsgBox s

    End Sub[/vba]

  3. #3
    Quote Originally Posted by Insomniac
    Not sure exactly what you mean, but using a user-defined data type to impliment some padding to space our columns. Alter the column widths for A,B,C from 20 to suit.[vba]Option Explicit

    Type Pad
    a As String * 20
    B As String * 20
    C As String * 20
    End Type

    Sub MsgBoxCols()
    Dim p As Pad, i As Long, s As String

    With p
    For i = 1 To 5
    .a = "ColA line" & i
    .B = "ColB line" & i
    .C = "ColC line" & i
    s = s & .a & .B & .C & vbLf
    Next
    End With

    MsgBox s

    End Sub[/vba]
    Hi Insomniac,
    Works great, exactly what i was looking for.
    Thx Much.
    Dave
    "The game is afoot Watson"

Posting Permissions

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