I have created a coding to send emails using excel but iam unsure how to do this using access. I have a table that contains all of the info i need in the email and I want to create a button to automatically send out emails using access..below is the sample coding I currently use in excel :
Sub SendMail()
'
' SendMail Macro
' created 4-5-17
Dim Answer As VbMsgBoxResult
Answer = MsgBox("Are you sure you want to send Emails?", vbYesNo, "Send Emails")
If Answer = vbYes Then
Dim olApp As Outlook.Application
Dim olMail As Outlook.MailItem
For I = 2 To Sheet1.Cells(Rows.Count, 1).End(xlUp).Row
Set olApp = CreateObject("Outlook.application")
Set olMail = olApp.CreateItem(olMailItem)
With olMail
.To = Cells(I, 1).Value
.Subject = Cells(I, 2).Value
.BodyFormat = olFormatHTML
.HTMLBody = Cells(I, 3).Value
.Attachments.Add (Cells(I, 4).Value)
.SendUsingAccount = Outlook.Session.Accounts.Item(1)
.Display
''.Send
End With