Ok, VBA is all new to me. Below is a code I've been able to edit to fit my need so far. What I'm trying to do is send several e-mails to different people. Each e-mail has a specific attachment(s) and different people depending on the attachment. I've built a table in my dbs with column 1 being attachment path and column 2 being the string of e-mails associated. Can anyone help me develop a script in addition to the below to get this to run with the click of a button? Thanks in advance.
Option Compare Database
Sub SendMessage(Optional Attachment)
Dim strEmail, strBody As String
Dim appOutLook As Outlook.Application
Dim MailOutLook As Outlook.MailItem
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
strEmail = "[EMAIL ADDRESS]"
strBody = "FOR OFFICIAL USE ONLY. This electronic transmission contains personal information protected by the Privacy Act of 1974 (see AFI 33-332) and the Health Insurance Portability and Accountability Act (HIPAA) (see DoD6025.18-R) and is not intended for disclosure outside government channels and exempt from mandatory disclosure under the Freedom of Information Act, 5 U.S.C., 552. Exemption 6 may apply. Do not release outside of DoD channels without the consent of the originator's office. If you received this message in error, please notify the sender by reply e-mail and delete all copies of this message." & Chr(13) & Chr(13)
strBody = strBody & "FYI." & Chr(13) & Chr(13)
strBody = strBody & "V/R" & Chr(13) & Chr(13)
strBody = strBody & "//SIGNED//" & Chr(13) & Chr(13)
strBody = strBody & "NEIL E. WEST II, SSgt, USAF" & Chr(13) & Chr(13)
strBody = strBody & "NCOIC, PSM" & Chr(13) & Chr(13)
strBody = strBody & "DSN: 754-3253" & Chr(13) & Chr(13)
strBody = strBody & "COMM: 202-404-3253" & Chr(13) & Chr(13)
With MailOutLook
.To = "[email@domain]"
.CC = "[otheremail@domain]"
.Subject = "FOUO: Monthly Rosters"
.Body = strBody
.Importance = olImportanceHigh
.Sensitivity = olConfidential
.Attachments.Add "[Attachment Path]", olByValue, 1
.Display
End With
DriverExit:
On Error Resume Next
Set MailOutLook = Nothing
Set appOutLook = Nothing
Exit Sub
End Sub
Option Compare Database
Sub SendMessage(Optional Attachment)
Dim strEmail, strBody As String
Dim appOutLook As Outlook.Application
Dim MailOutLook As Outlook.MailItem
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
strEmail = "[EMAIL ADDRESS]"
strBody = "FOR OFFICIAL USE ONLY. This electronic transmission contains personal information protected by the Privacy Act of 1974 (see AFI 33-332) and the Health Insurance Portability and Accountability Act (HIPAA) (see DoD6025.18-R) and is not intended for disclosure outside government channels and exempt from mandatory disclosure under the Freedom of Information Act, 5 U.S.C., 552. Exemption 6 may apply. Do not release outside of DoD channels without the consent of the originator's office. If you received this message in error, please notify the sender by reply e-mail and delete all copies of this message." & Chr(13) & Chr(13)
strBody = strBody & "FYI." & Chr(13) & Chr(13)
strBody = strBody & "V/R" & Chr(13) & Chr(13)
strBody = strBody & "//SIGNED//" & Chr(13) & Chr(13)
strBody = strBody & "NEIL E. WEST II, SSgt, USAF" & Chr(13) & Chr(13)
strBody = strBody & "NCOIC, PSM" & Chr(13) & Chr(13)
strBody = strBody & "DSN: 754-3253" & Chr(13) & Chr(13)
strBody = strBody & "COMM: 202-404-3253" & Chr(13) & Chr(13)
With MailOutLook
.To = "[email@domain]"
.CC = "[otheremail@domain]"
.Subject = "FOUO: Monthly Rosters"
.Body = strBody
.Importance = olImportanceHigh
.Sensitivity = olConfidential
.Attachments.Add "[Attachment Path]", olByValue, 1
.Display
End With
DriverExit:
On Error Resume Next
Set MailOutLook = Nothing
Set appOutLook = Nothing
Exit Sub
End Sub