PDA

View Full Version : Solved: Columns in MsgBox



Desert Piranha
11-20-2005, 04:52 PM
Hi all,

I know how to make lines in a MsgBox.
IE:
Sub example3()
MsgBox "This is example 3" & vbLf & "This is line 2" _
& Chr(13) & "This is line 3"
End SubQuestion: Is there a way to make Columns??
Thx

Insomniac
11-21-2005, 01:25 AM
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.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

Desert Piranha
11-22-2005, 09:28 AM
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.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
Hi Insomniac,
Works great, exactly what i was looking for.
Thx Much.