Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding two files as attechment to an e-mail

Status
Not open for further replies.

wsuess

Programmer
Aug 13, 2002
9
0
0
DE
i work with access and want to send an email with two or three files as attachment. How can i add these FILES to my e-mail??

this way makes no sense in my vba code:

Dim stAnhang As Attachments

stAnhang.Add "C:\Dokumente\ts3581\maritim.jpg"
stAnhang.Add "C:\Dokumente\ts3581\adlon.jpg"

Docmd.SendObject >??<, stAnhang, , email-adress

has anyone an idea??
 
Something like this

.AttachmentIndex = 0
.AttachmentPosition = 0
.AttachmentName = attach1name
.AttachmentPathName = attach1path


.AttachmentIndex = 1
.AttachmentPosition = 1
.AttachmentName = attach2name
.AttachmentPathName = attach2path Peter Meachem
peter @ accuflight.com

 
it doesn't work. there is always the error-message with this &quot;with-instruction&quot;. whats this?
how can i use the with-instruction? i looked into my msdn library, but the examples didn't work.
need i a special library under tools | references ??

my head is spinnig around. this darn error makes me crazy ...
 
I assume you're using a MapiMessages Control.

If so put:
Code:
With MAPIMessages1
before Peter's code
and
Code:
End With
after it, Let me know if this helps
________________________________________________________________
If you are worried about how to post, please check out FAQ222-2244 first

'There are 10 kinds of people in the world: those who understand binary, and those who don't.'
 
hi,

yesterday i tried an other way and it worked.
this is the code i tried

Dim objOutlook As Outlook.Application
Dim objAppt As Outlook.MailItem

Set objOutlook = CreateObject(&quot;Outlook.Application&quot;)

Set objAppt = objOutlook.CreateItem(olMailItem)

With objAppt
.Attachments.Add (&quot;I:\wolle.jpg&quot;)
.Attachments.Add (&quot;I:\wolle2.jpg&quot;)
.To = &quot;ts3581&quot;
.Subject = &quot;Betreff&quot;
.Send
End With

But also for all the ideas and solutions : thanx!
 
How do you get around the outlook security dialog?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top