Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA written for Emailing reports from Access

Status
Not open for further replies.

B555

Technical User
Feb 7, 2005
36
US
We are currently converting from Lotus Notes to Outlook express for our Email program. I have logic in place that uses Lotus notes to email reports out of Access, But does anyone have logic for outlook express? I will attach my Lotus Notes logic. Also has anyone else ever used any Mapi logic to send out Emails from Access? Thanks for any help.

Sub EMailUsingLotusNotes(strSubject As String, strFile As String, _
strAddress As String, Optional strCopyTo As String, Optional strBody As String)
On Error GoTo Err_EMailUsingLotusNotes

' Sends simple email using Lotus Notes
' Does NOT Require Reference to Lotus Notes Object Library
' does not save to users sent box

Dim LotusSes As Object ' Lotus Notes Session
Dim LotusDbs As Object ' Lotus Notes Database
Dim LotusDoc As Object ' Lotus Notes Document
Dim LotusItem As Object ' Lotus Notes RichTextFile
Dim AttachedFile As Object ' Attachment

Set LotusSes = CreateObject("Notes.NotesSession")
Set LotusDbs = LotusSes.GETDATABASE("", "")
LotusDbs.OPENMAIL
Set LotusDoc = LotusDbs.CREATEDOCUMENT()
Set LotusItem = LotusDoc.CREATERICHTEXTITEM("Attachment")
Set AttachedFile = LotusItem.EMBEDOBJECT(1454, "", strFile)
With LotusDoc
.Subject = strSubject
.Body = strBody
.SendTo = strAddress
.CopyTo = strCopyTo
.SAVEMESSAGEONSEND = True
.Send False
End With

ExitHere:
Set LotusSes = Nothing
Set LotusDbs = Nothing
Set LotusDoc = Nothing
Exit Sub

Err_EMailUsingLotusNotes:
MsgBox "Error: Email was not sent to " & strAddress, _
vbOKOnly, "Error Sending Email!"
Resume ExitHere

End Sub
 
Thanks, I will try it out. B555
 
Is there something similar to this for emailing Access tabels or queries?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top