[AccessD] Email - Attachments

Dan Waters dwaters at usinternet.com
Sat Feb 13 10:09:53 CST 2010


Hi Tony,

This part of what I use:

Set outApp = CreateObject("Outlook.Application")
Set outMail = outApp.CreateItem(olMailItem)

With outMail

    If stgAttachmentList <> "" Then
        Do While stgAttachmentList <> ""
            If InStr(stgAttachmentList, ";") <> 0 Then
                .Attachments.Add Left(stgAttachmentList,
InStr(stgAttachmentList, ";") - 1)
                stgAttachmentList = Mid(stgAttachmentList,
InStr(stgAttachmentList, ";") + 1)
            Else
                .Attachments.Add stgAttachmentList
                stgAttachmentList = ""
            End If
        Loop
    End If
    
End With

This is part of a procedure which handles all Outlook emails.  I pass in the
stgAttachmentList, which is a string of one or more full paths to the files
I want to attach, and I've separated each path with a semicolon.

Should work!
Dan

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Tony Septav
Sent: Saturday, February 13, 2010 9:47 AM
To: Access Developers discussion and problem solving
Subject: [AccessD] Email - Attachments

Hey All
I know this has been discussed many times. But I was wondering if there 
was simple code available to send an EMail with several attachments.  I 
have been using some clean old code that Shamil  and I discussed years 
ago.  It detects the user's EMailer and opens it up. You can automate 
the  MailTo,  Subject and Body text, but you cannot automate the ability 
to add attachments. Works like a beauty and because it was only one 
converted PDF file at a time, the user didn't mind manually adding an 
attachment.  But now we have a to send a series of quarterly reports.

Thanks
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list