[AccessD] SendObject

dmcafee at pacbell.net dmcafee at pacbell.net
Sat Aug 6 16:14:48 CDT 2005


If you are using Outlook 2000 SP2 or higher, you will also have to deal with
confirming that the email is good.

Another thing you can try is blat. List member Francisco Tapia has a great
sample on rogersaccesslibrary under other developers.  Blat runs behind the
scenes and we added it to the error handling. This is the way Outlook SHOULD
(and used to) work.

David


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Barbara Ryan
Sent: Saturday, August 06, 2005 12:23 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] SendObject


Thanks, Andy.... I really appreciate it!.....Barb



----- Original Message -----
From: "Andy Lacey" <andy at minstersystems.co.uk>
To: "'Access Developers discussion and problem solving'"
<accessd at databaseadvisors.com>
Sent: Saturday, August 06, 2005 1:44 PM
Subject: RE: [AccessD] SendObject


> Here you go Barbara
>
> Don't forget to set a Reference to the Outlook Object Library and put in
> error trapping etc
>
>
>
> Function SendOutlookMessage()
>
> Dim objOutlook As Outlook.Application
> Dim objOutlookMsg As Outlook.MailItem
> Dim objOutlookRecip As Outlook.Recipient
> Dim objOutlookAttach As Outlook.Attachment
> Dim objOutlookNameSpace As Outlook.NameSpace
> Dim objOutlookItem As Outlook.ContactItem
> Dim objOutlookFolder As Object
> Dim lngCounter As Long
> Dim astrRecipients() As String
> Dim astrAttachments() As String
> Dim strSubject As String
> Dim strBody As String
>
> 'Put code in here to build up array of recipients and attachments
>
>
> 'Create the Outlook session
> Set objOutlook = CreateObject("Outlook.Application")
>
> Set objOutlookNameSpace = objOutlook.GetNamespace("MAPI")
> Set objOutlookFolder =
> objOutlookNameSpace.GetDefaultFolder(olFolderContacts)
>
> 'Create the message
> Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
> With objOutlookMsg
>   'Add recipients
>   For lngCounter = 1 To UBound(astrRecipients)
>     Set objOutlookRecip = .Recipients.Add(astrRecipients(lngCounter))
>     objOutlookRecip.Type = olTo
>   Next
>   'Resolve each recipients name
>   For Each objOutlookRecip In .Recipients
>     objOutlookRecip.Resolve
>   Next
>   .Subject = strSubject
>   .Body = strBody
>   .Importance = olImportanceNormal
>   For lngCounter = 1 To UBound(astrAttachments)
>     Set objOutlookAttach = .Attachments.Add(astrAttachments(lngCounter))
>   Next
>   .Save
>   .Send
> End With
>
> End Function
>
> HTH
>
> -- Andy Lacey
> http://www.minstersystems.co.uk




More information about the AccessD mailing list