Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing in correct column

Status
Not open for further replies.

Sika2

Technical User
Sep 25, 2001
41
NZ
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)
 
Look into the Format function

[fish] No Dolphins were harmed in the posting of this message... Dolphin Friendly Tuna!

Ever feel like you're banging your head against a tree? I did, so I cut down the tree.
 
Thanks. I Have found the answer lies in the font. I have changed the font and the code now works.

Thanx
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top