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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

aligning text output 2

Status
Not open for further replies.

tmangin

Programmer
Oct 29, 2003
16
US
I'm running a program that returns output to a text file (notepad). Each line of output contains a four digit ID, name of client, number of times ID is in the file, and an amount. For example:

2701 RADIOLOGY CONSULTANTS, INC. 2 3,225,228.00
2710 TEST 1 190.00
2607 RADILOGICAL CONSULTANTS PROF ASSOC 1 325,695.65

As of now, this is the type of output I get. The names will always vary in length. What I want to do is have all the numbers after the names line up, so that my output would look like:

2701 RADIOLOGY CONSULTANTS, INC. 2 3,225,228.00
2710 TEST 1 190.00
2607 RADILOGICAL CONSULTANTS PROF ASSOC 1 325,695.65

I've searched through the forums and can't seem to find anything that will help me here. I've tried using formatting, such as (Format(Amt, "Standard"), "@@@@@@@@"), but it's not helping to line up the numbers. I would greatly appreciate any input!
Thanks!
 
You could pad with spaces for example let's say you want the name of client to be a max of 40 Char do something like:

strNameOfClient = Left(strNameOfClient, 40)
strNameOfClient = strNameOfClient & Space(40 - len( strNameOfClient))

Then do something similar to the Amount just putting the spaces before the amount.
 
DrJavaJoe,
Your suggestion worked like a charm! Thanks so much for your help.
 
Try Format$(Format$(12345.6, "0.00"), "@@@@@@@@")

Swi
 
Swi,
Thanks for your help. I actually used a version of what you suggested.
Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top