table and indentation in outlook form messages

G

Guest

Hi,

I am really stuck on one of my forms and I am just wondering if you can help
me with VBScript. I am new to the language so I do not know many of the
methods or objects....

I'm trying to create a form such that when it is sent, the data the user
entered will be displayed in a set email format....that is to have the data
entered displayed in 2 columns with all text indented to the left of the
column

is there a way that i can do this in outlook using VBScript?

Thanks heaps for any help
 
S

Sue Mosher [MVP-Outlook]

Yes, by creating an HTML format message. Set the MailItem.HTMLBody property
to the fully tagged HTML content. "Columns" in HTML, of course, translate
into tables, using the <table> tag and its related tags for rows and
individual cells. Any basic HTML text or site can give you details. For a
code sample showing an HTML message with a table being created from calendar
data, see http://www.outlookcode.com/codedetail.aspx?id=24
 
G

Guest

Thanks Sue for your help.

HTML looks a bit complex and I don't know exactly how to start it
that example made it a bit confusing

Is there a way that I can align the text using spaces and Len() funtion

string1 = "Employee ID:"
newString1 = string1 & Space(30 - Len(Trim(string1))) & "123"
string2 = "User ID:"
newString2 = string2 & Space (30 - Len(Trim(string2))) & "456"
msg = newString1 & chr(13) & newString2
Item.Body = msg

Here is what I have right now and logically, there should be 30 spaces from
the beginning of the line till the actual data...but when i send the message
, the text (123 and 456) are not aligned even thought there are meant to be
30 spaces from the beginning of the line till ("1" and "4")

Am i doing something wrong or is VBScript playing character tricks?

Thanks for your help once again
 
S

Sue Mosher [MVP-Outlook]

I strongly suggest that you use a proper HTML table. That method involves no
calculations such as those you'd need to line up text with spaces.

Also using spaces to line up text works only if you generate a plain text
message -- and that's possible only with Outlook 2002 or later (or with CDO
in earlier versions).
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top