[AccessD] SendObject

Barbara Ryan BarbaraRyan at cox.net
Sat Aug 6 14:23:24 CDT 2005


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
>
>
>
> > -----Original Message-----
> > From: accessd-bounces at databaseadvisors.com
> > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
> > Barbara Ryan
> > Sent: 06 August 2005 12:03
> > To: Access Developers discussion and problem solving
> > Subject: Re: [AccessD] SendObject
> >
> >
> > Thanks for the info.  Andy, that would be great if you could
> > send an example.....Barb
> >
>
> -- 
> 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