How to create a VBA code to create an email in MS Access with email address from multiple forms?

I created a macro through the macro builder, but I have a few issues that I’m hoping to resolve by creating the email through vba.

Issue 1: Unable to add the signature block
Issue 2: The email addresses are being pulled from forms, but if one of the forms is blank the macro stops

TO: Forms!frmFOL![FOL Email] & "; " & Forms!frmFSL![FSL Email]
CC: Forms!frmFSL![FSL Email] & "; " &
Who is Participating?

pls try

Sub CreateMail()

   Dim OlApp As Outlook.Application
   Dim ObjMail As Outlook.MailItem

   Set OlApp = Outlook.Application
   Set ObjMail = OlApp.CreateItem(olMailItem)

   ObjMail.To = Nz(Forms!frmFOL![FOL Email], "") & "; " & Nz(Forms!frmFSL![FSL Email], "")
   ObjMail.CC = Nz(Forms!frmFSL![FSL Email], "") & "; " & ""
   ObjMail.Subject = "YourSubject"
   'You now have the default signature within ObjMail.HTMLBody.
   'Add this after adding strHTMLBody
   ObjMail.HTMLBody = "YourBodyText" & ObjMail.HTMLBody

   'ObjMail.Send 'send immediately or
   'ObjMail.close olSave 'save as draft
   'Set OlApp = Nothing

End Sub

Open in new window

kbay808Author Commented:
Sorry for the delay.  Thanks for your help
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.