PC Review


Reply
Thread Tools Rate Thread

Re: Email Multiple Attachments

 
 
Sandra Daigle
Guest
Posts: n/a
 
      11th Dec 2003
Not using sendobject - just one of the many limitations of sendobject
(others are found here: http://www.granite.ab.ca/access/sendobject.htm).

For other methods of sending email check these links:

http://www.granite.ab.ca/access/email.htm

Q161088 Using Automation to Send a Microsoft Outlook Message
http://support.microsoft.com/default...;en-us;Q161088

HOW TO: Use Automation to Send a Microsoft Outlook Message using Access 2000
http://support.microsoft.com/default...;en-us;Q209948

Here's a slightly modified version of the code from the last article which
shows how to add more than one attachment:

Sub SendMessage(DisplayMsg As Boolean, Optional AttachmentPath1 As String,
Optional attachmentpath2 As String)
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")

' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)

With objOutlookMsg
' Add the To recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add("(E-Mail Removed)")
objOutlookRecip.Type = olTo

' Add the CC recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add("(E-Mail Removed)")
objOutlookRecip.Type = olCC

' Add the BCC recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add("Sandra Daigle")
objOutlookRecip.Type = olBCC

' Set the Subject, Body, and Importance of the message.
.Subject = "This is an Automation test with Microsoft Outlook"
.Body = "This is the body of the message." & vbCrLf & vbCrLf
.Importance = olImportanceHigh 'High importance
' Add attachments to the message.
If Not IsMissing(AttachmentPath1) Then
.Attachments.Add AttachmentPath1
End If
If Not IsMissing(attachmentpath2) Then
.Attachments.Add attachmentpath2
End If
' Resolve each Recipient's name.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
Next
End With
Set objOutlook = Nothing
End Sub



--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.


D Collins wrote:
> I have a button on a form that uses the Send Object
> command to send a report as a snapshot. Is it possible
> to send more than one attachment in the same email via
> code?
>
> Thanks.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Email Multiple Files to Multiple Email addresses LoriH Microsoft Excel Programming 3 2nd Mar 2009 09:08 PM
forwarding email with attachments - attachments are not there =?Utf-8?B?VGFyYSBhdCBXYWxzaA==?= Microsoft Outlook Discussion 1 30th Apr 2007 09:20 PM
Multiple Email Addresses..................Multiple Email Accounts =?Utf-8?B?MjNIaXRhbW4=?= Microsoft Outlook Discussion 2 17th Oct 2006 10:02 PM
Multiple email accounts to multiple PSTs or at least multiple Inbo =?Utf-8?B?SmVmZiBUaG9tYXM=?= Microsoft Outlook Discussion 1 7th May 2006 01:29 AM
When others forward my email with attachments the attachments won. =?Utf-8?B?bnA=?= Microsoft Outlook Discussion 2 5th Jan 2005 05:21 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:22 PM.