CDO.Message seems to remove formatting from Excel file

R

Rich

I am creating an Excel file and then saving it to the hard drive. After
it is saved, I send it with the following code:

set objNewMail = CreateObject("CDO.Message")
objNewmail.Subject = "My Subject"
objNewMail.textBody = "Test of email"
objNewMail.From = "(e-mail address removed)"
objNewMail.To = "(e-mail address removed)"
objNewMail.AddAttachment "C:\myFile.xls"
objNewMail.Send

This excel file has some basic formatting (Bold header row that is
underlined, a date column).

When the file arrives in my email, all of the formatting is gone. All
the rows have the same font and the date column is 38702 rather than a
actual date like 12/16/2005.

If i open the file from the harddrive it is fine.

If I create a message with Outlook and send the file as an attachment,
it is fine.

Can anyone help with this?

Thanks,

Rich
 
R

Rich

Answered my own question. For those with a similar issue, it seems you
need to specify a few additional things:

objNewMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objNewMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = _
"myserverl"
objNewMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objNewMail.Configuration.Fields.Update

Details can be found at:
http://www.microsoft.com/technet/scriptcenter/guide/sas_ent_wbpa.mspx
 

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