Apparently, MsgBox uses a proportionally spaced font, so padding data with spaces does not result in aligned columns as this code illustrates:
Code:
Const t1 As String = "abcdef"
Const t2 As String = "ABCDEF"
Const t3 As String = "xx yy zz"
Const d1 As Double = 0.4567
Const d2 As Double = 12.3456
Const d3 As Double = 333.4444
Dim msg As String
msg = Left(" Text ", 10) & Left(" Value ", 8) & vbCr _
& Left(t1 & " ", 10) & Right(" " & Format(d1, "##0.00"), 8) & vbCr _
& Left(t2 & " ", 10) & Right(" " & Format(d2, "##0.00"), 8) & vbCr _
& Left(t3 & " ", 10) & Right(" " & Format(d3, "##0.00"), 8)
MsgBox msg
msg = Left(" Text ", 10) & Left(" Value ", 8) & vbCr _
& Left(t1 & " ", 10) & Right(" " & Format(d1, "000.00"), 8) & vbCr _
& Left(t2 & " ", 10) & Right(" " & Format(d2, "000.00"), 8) & vbCr _
& Left(t3 & " ", 10) & Right(" " & Format(d3, "000.00"), 8)
MsgBox msg
Is there any way to make this work with MsgBox?
If not, is there another relatively simple way to get aligned columns displayed to the Word document?