Hi All,
I am using the following code to print string "numbers" in columns. The code works to align the numbers on the left but when the numbers are e.g. 5 with a 10 below and 123 below that I need them to be right aligned. I am not able to use them as straight numbers as some numbers have to print with an asterisk e.g. 7*.
The column currently prints as follows:
5
10
123
7*
I need it to print like this:
5
10
123
7*
This does not alighn correctly in post preview but I hope it is clear what I am trying to achieve with this. Any help appreciated. Thanks.
Public Function AddSpaces(OrigString As String, TotLen As
Integer) As String
If Len(OrigString) >= TotLen Then
AddSpaces = OrigString
Exit Function
End If
AddSpaces = OrigString & Space(TotLen - Len(OrigString))
End Function
Printer.Print AddSpaces("0.0 - 0.1m", 25) + AddSpaces(FrmPene.Tet1, 6) + AddSpaces(FrmPene.Tet13, 6) + AddSpaces(FrmPene.Tet25, 6) + AddSpaces(FrmPene.Tet37, 6)
I am using the following code to print string "numbers" in columns. The code works to align the numbers on the left but when the numbers are e.g. 5 with a 10 below and 123 below that I need them to be right aligned. I am not able to use them as straight numbers as some numbers have to print with an asterisk e.g. 7*.
The column currently prints as follows:
5
10
123
7*
I need it to print like this:
5
10
123
7*
This does not alighn correctly in post preview but I hope it is clear what I am trying to achieve with this. Any help appreciated. Thanks.
Public Function AddSpaces(OrigString As String, TotLen As
Integer) As String
If Len(OrigString) >= TotLen Then
AddSpaces = OrigString
Exit Function
End If
AddSpaces = OrigString & Space(TotLen - Len(OrigString))
End Function
Printer.Print AddSpaces("0.0 - 0.1m", 25) + AddSpaces(FrmPene.Tet1, 6) + AddSpaces(FrmPene.Tet13, 6) + AddSpaces(FrmPene.Tet25, 6) + AddSpaces(FrmPene.Tet37, 6)