Hi everyone, I am new to this programming language and I mean really new so please be patient with my lack of knowledge.
I have a form and I have added a checkbox to see what the person wants emailed. I need to be able to send out multiple attachments depending on what check boxes they select. This is the code I have so far.
It is working with just one attachment but not multiple.
Private Sub EmailCapabilities_Click()
Dim objol As Object
Dim objmail As Object
Set objol = CreateObject("Outlook.Application")
Set objmail = objol.createitem(0)
With objmail
.To = "email"
.bcc = "email"
.Subject = "NIS Capabilities Statement"
.Body = "Dear " & FirstName & " " & LastName & ": " & "I have attached the NIS Capabilities Statement, for your convenience. Please feel free to contact me with any questions you may have."
.NoAging = True
If Me.CapStmt = Yes Then
Set objOutlookAttach = .Attachments.Add("C:\Users\Physician Source 4\Documents\personal\NIS Capabilities Statement.pdf")
End If
If Me.CapList = Yes Then
Set objOutlookAttach = .Attachments.Add("C:\Users\Physician Source 4\Documents\personal\NIS Capabilities List.pdf")
End If
If Me.CapMaint = Yes Then
Set objOutlookAttach = .Attachments.Add("C:\Users\Physician Source 4\Documents\personal\NIS Capabilities Maintenance Statement.pdf")
End If
.Display
End With
Set objmail = Nothing
Set objol = Nothing
End Sub
Thank you so much!