Problem Attaching File to Email

S

Sharkbyte

I have setup email, using CDO, in a database. I have incorporated
www.lebans.com's code for creating a PDF.

However, when I configure my CDO.Message object, I get an

"Object doesn't support this property or method. Error Number 438"

Here is the offending code. It is the .AddAttachment property.

With iMsg
.To = gblEmail1
.From = gblEmailFrom
.BCC = gblEmailBCC
.Subject = gblEmailSubject
.Sender = gblEmailReply
.ReplyTo = gblEmailReply
.HTMLBody = gblEmailBody
.AddAttachment = "c:\tsw\" & gblReportName


Can anyone offer a suggestion on the correct property name? I can't track
it down.

Thanks.

Sharkbyte
 
H

Hans Up

Sharkbyte said:
I have setup email, using CDO, in a database. I have incorporated
www.lebans.com's code for creating a PDF.

However, when I configure my CDO.Message object, I get an

"Object doesn't support this property or method. Error Number 438"

Here is the offending code. It is the .AddAttachment property.

With iMsg
.To = gblEmail1
.From = gblEmailFrom
.BCC = gblEmailBCC
.Subject = gblEmailSubject
.Sender = gblEmailReply
.ReplyTo = gblEmailReply
.HTMLBody = gblEmailBody
.AddAttachment = "c:\tsw\" & gblReportName

I haven't tried this myself, but it looks to me like AddAttachment is a
method rather than a property. You can't assign a value (as in .method
= value) to property. Try it like this:

..AddAttachment ("c:\tsw\" & gblReportName)
 
H

Hans Up

Hans said:
I haven't tried this myself, but it looks to me like AddAttachment is a
method rather than a property. You can't assign a value (as in .method
= value) to property. Try it like this:

.AddAttachment ("c:\tsw\" & gblReportName)

I meant to say "to a method" instead of "to property".

And I don't if the parentheses would be required. So maybe try it this
way, too:

..AddAttachment (\"c:\tsw\" & gblReportName
 
D

Dorian

Why dont you look in the Object Browser. It will list all the properties and
methods for each object.
Click F2 from any code window and select your CDO library.
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".
 
S

Sharkbyte

Dorian:

I tried but do not find the Object...



Dorian said:
Why dont you look in the Object Browser. It will list all the properties and
methods for each object.
Click F2 from any code window and select your CDO library.
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".
 
S

Sharkbyte

Hans Up

The actual line ended up being

..AddAttachment ("c:\tsw\" & gblReportName)

Thanks for the help.

Sharkbyte
 

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