Hello all,
I currently use an Access database to store my customer details.
In this database I created forms to search, select and view the customer details. On the form, I created the option to generate and e-mail message, to this particular customer. This is working fine, except for the fact that these e-mails are in plain text, without any pictures and just not looking great... it's 2016 so there should be nicer methods available...
So, I would like to change my existing code to generate nice looking, rich, html formatted e-mails. I was thinking about using a Word template and filling that in, but I'm not sure. Do you have any idea's?
What are the common methods for generating nice looking e-mails?
Thanks in advance.
My current code:
I currently use an Access database to store my customer details.
In this database I created forms to search, select and view the customer details. On the form, I created the option to generate and e-mail message, to this particular customer. This is working fine, except for the fact that these e-mails are in plain text, without any pictures and just not looking great... it's 2016 so there should be nicer methods available...
So, I would like to change my existing code to generate nice looking, rich, html formatted e-mails. I was thinking about using a Word template and filling that in, but I'm not sure. Do you have any idea's?
What are the common methods for generating nice looking e-mails?
Thanks in advance.
My current code:
Code:
Private Sub cmdCreateMail_Click()
On Error GoTo Err_cmdCreateMail_Click
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
' Add the To recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add("info@xxxxxx.nl")
objOutlookRecip.Type = olTo
' Set the Subject, Body, and Importance of the message.
.Subject = "This is the e-mail subject"
.Body = "Dear mister," & vbNewLine _
& vbNewLine _
& "Installer company: " & Me.fldFitterCompanyName & vbNewLine _
& "Installer name: " & Me.fldFitterName & vbNewLine _
& "Date: " & Me.fldFitterDateInstalled & vbNewLine _
& vbNewLine _
& "With kind regards," & vbNewLine _
& "Companyname"
' Resolve each Recipient's name.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
Next
.Display
End With
Set objOutlook = Nothing
Exit_cmdCreateMail_Click:
Set objOutlook = Nothing
Exit Sub
Err_cmdCreateMail_Click:
MsgBox "Errorcode = " & Err.Number & vbNewLine & _
"Description = " & Err.Description, vbOKOnly + vbCritical, conAppName
Resume Exit_cmdCreateMail_Click
End Sub