Problem Attaching File to Email

  • Thread starter Thread starter Sharkbyte
  • Start date Start date
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
 
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)
 
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
 
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".
 
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".
 
Hans Up

The actual line ended up being

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

Thanks for the help.

Sharkbyte
 
Back
Top