Thanks Eric....however....
I was originally using the SendObject command, but it
doens't allow me to change the senders name or resolve the
email addresses before sending.
Any other ideas?
>-----Original Message-----
>You have a very sophistcated set of code there. I would
>use the docmd.sendobject.
>Ex
>
> DoCmd.Sendobject acReport, "report name", _
> "SnapshotFormat(*.snp)", "JTO@address", _
> "JCC@address", "JBCC@address", "subject", "text",
>True, ""
>
>Watch out for wordrap
>The report name, email addresses, subject and text can
all
>come from an open form
>
>Eric
>
>>-----Original Message-----
>>Gurus-
>>I am using the following code to send email from Access
>>2000 through Outlook 2000. While the code itself works
>>fine, I am stumped as to how I can add a report in
>>snapshot format as an attachment to the email. Any help
>>would be very much appreciated.
>>
>>Sub SendMessage(Optional AttachmentPath)
>>On Error GoTo Err_Send
>>
>> Dim objOutlook As Outlook.Application
>> Dim objOutlookMsg As Outlook.MailItem
>> Dim objOutlookRecip As Outlook.Recipient
>> Dim objOutlookAttach As Outlook.Attachment
>>
>>
>> ' 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(Forms!
>>[frmnewrequest]![Caller])
>> objOutlookRecip.Type = olTo
>>
>> ' Add the CC recipient(s) to the message.
>>
>>
>> ' Set the Subject, Body, and Importance of the
>>message.
>> .Subject = "Request #" & Forms![frmnewrequest]!
>>[ReqID] & " has been received"
>> .Body = "Thank you for your recent call to
Resource
>>Planning. Attached you will find the details of the
>>segments (exceptions) we have entered and/or all
>requested
>>skill changes. If you made a request on behalf of
>another
>>coach, please ensure they are provided a copy of this
>>confirmation if they were not included in this
>>communication. Please ensure that you review the
>important
>>notes included in the attachment. If you have any
>>questions, please feel free to reply to this email or
>call
>>us at (360) 756-7155 and reference the request number
>>listed above. Thank you!" & vbCrLf & vbCrLf
>> .Importance = olImportanceNormal
>>
>> ' Add attachments to the message.
>> If Not IsMissing(AttachmentPath) Then
>> Set objOutlookAttach = .Add(AttachmentPath)
>> End If
>>
>> ' Resolve each Recipient's name.
>> For Each objOutlookRecip In .Recipients
>> objOutlookRecip.Resolve
>> If Not objOutlookRecip.Resolve Then
>> objOutlookMsg.Display
>> End If
>> Next
>> .Display
>>
>> End With
>> Set objOutlookMsg = Nothing
>> Set objOutlook = Nothing
>>
>>Exit_Send:
>>Exit Sub
>>
>>Err_Send:
>>MsgBox Err.Description
>>GoTo Exit_Send
>>
>>End Sub
>>.
>>
>.
>
|