send emails with attchments

M

Myriam

Hello, everyone,
I'm trying to send e-mails to my clients with an attachment. I'm using
Office 2003.
I've been able to send emails using a recordset, typing in the Subject, CC
and Remarks in a form. It works very well. However, I cannot make the
Attachment.Add work!! I'm quite frustrated! Please help!

I am typing in the path in the form:
............
Set AttachmentPath = Forms!MAIL[Attachment]
.....
'Add the attachment to the e-mail message.
If Not IsMissing(AttachmentPath) Then
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
End If
 
S

Sue Mosher [MVP-Outlook]

Wouldn't it be:

AttachmentPath = Forms!MAIL[Attachment]

to set a string rather than an object?
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
E

Eric Legault [MVP - Outlook]

Try running the code with a known file rather than relying on the value of a
field in your Access form. Also include the optional parameters just in case:

..Attachments.Add "C:\Test.doc", olByValue, 1, "Test"
 
L

Liz

Thanks, Eric and Sue for replying.

I tried Eric's suggestion but it did not work. I deleted "Set
AttachmentPath = Forms!MAIL[Attachment] " and entered Eric's
suggestion, but it does not insert the attachment.

I would like to have the Attachment File Name on the form, just as the
cc addresses...

Thanks for your help. I really appreciate it.
 
L

Liz

Sue,
I took the 'set' out and it did read it as a string, however the
problem lies in the objOutlookAttach

Set objOutlookAttach = .Attachments.Add(AttachmentPath)

When I debug the objOutlookAttach = nothing
while Attachment Path = c:\test.doc
gives the correct path.

Any other suggestions?
Thanks.
 
S

Sue Mosher [MVP-Outlook]

What is a typical value for AttachmentPath from one of your actual data records? Have you checked to make sure that it points to an actual file?

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


Liz said:
Sue,
I took the 'set' out and it did read it as a string, however the
problem lies in the objOutlookAttach

Set objOutlookAttach = .Attachments.Add(AttachmentPath)

When I debug the objOutlookAttach = nothing
while Attachment Path = c:\test.doc
gives the correct path.

Wouldn't it be:

AttachmentPath = Forms!MAIL[Attachment]

to set a string rather than an object?

Myriam said:
Hello, everyone,
I'm trying to send e-mails to my clients with an attachment. I'm using
Office 2003.
I've been able to send emails using a recordset, typing in the Subject, CC
and Remarks in a form. It works very well. However, I cannot make the
Attachment.Add work!! I'm quite frustrated! Please help!

I am typing in the path in the form:
...........
Set AttachmentPath = Forms!MAIL[Attachment]
....
'Add the attachment to the e-mail message.
If Not IsMissing(AttachmentPath) Then
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
End If
 

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