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

Formating test string in body of email

Status
Not open for further replies.

marcon

Programmer
Aug 30, 2001
21
US
I am being asked to put a table in the body of an email
message. Everything should line up nicely in columns.
The data comes from an unformated string. Ex

Customer, Part, DateStart, DateEnd, Discount.

Of course the length of each field varies so it does not look like a table. ex

Greg Marmalardoski abc Jan02 Mar02 7%
Mandy Pepridge abc Jan02 Mar02 8%

Any suggestions on how to line up everything evenly in columns?
All I can come up with is counting characters in each field and adding spaces to the string. ( ughhh)

I realize there are other ways via attachments but I am responding to a very specific user request.

Any comments welcome. Thanks!

 
If you know that the user will have an e-mail client that supports HTML (Outlook, Outlook Express, Netscape Mail, etc.) you can use HTML to format the table.

Code:
<TABLE>
<TR>
<TD>Customer</TD>
<TD>Part</TD>
<TD>DateStart</TD>
<TD>DateEnd</TD>
<TD>Discount</TD>
</TR> 
</TABLE>
 
Hi!

You can make the output line up by using the format statement: Format(YourField, &quot; &quot;). Noting that this will automatically right align the output. You can build your body string using these format statements and vbCrLf which will take the output to a new line.

hth
Jeff Bridgham
bridgham@purdue.edu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top