Access/Outlook Email Automation

  • Thread starter Thread starter redpoppy
  • Start date Start date
R

redpoppy

I've just discovered "Automation" and am trying to implement it in m
Access d/b to send reports and external file attachments via e-mail
I'm not a VB programmer but I've searched on the web to find some cod
that mostly works OK (extract below) - I have 3 questions on this tha
I haven't been able to figure out:
1) Is it possible to set up ".Body" to the contents of an external fil
- eg: an Access report saved in RTF or HTML format, (or any othe
external file for that matter), rather than having to hard-code th
text?
2) What changes need to be made to the code to add more than
attachment?
3) Is it possible to set up a link in the body of the email to open th
attachments? eg: "click here to view your quotation".
Any help will be much appreciated.
--------------------------------------
With objOutlookMsg
' Add the To recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add("Nancy Davolio")
objOutlookRecip.Type = olTo

' 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

' Add attachments to the message.
If Not IsMissing(AttachmentPath) Then
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
End If

' Resolve each Recipient's name.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
Next

' Should we display the message before sending?
If DisplayMsg Then
.Display
Else
.Save
.Send
End If
End With
 
Back
Top