Hello,
I have figured out how to embed an image to an auto generated email using the .HTMLBody property. But I also want to add text to the body of the email. Whenever I add text to the .Body property it doesn't appear. Then I thought about adding some vbNewLine's after the .HTMLBody property and then adding the text. It brings the text right under the image but I cant space it out any further or create more spaces for more text. If anyone could help me out I would appreciate it. I will post my code below:
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
' 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. Substitute
' your names here.
Set objOutlookRecip = .Recipients.Add("Recipient Name") '<--Recipient's name or email address
objOutlookRecip.Type = olTo
' Add the CC recipient(s) to the message.
'Set objOutlookRecip = .Recipients.Add("CC Recipient Name")
'objOutlookRecip.Type = olCC
' Set the Subject, Body, and Importance of the message.
.Subject = "This is an Automation test with Microsoft Outlook" '<--Subject
'.Body = "vbNewLine & vbNewLine & vbNewLine" & "NOTE: Some of you have may have been deactivated for 12+ months" & _
"of non-use. If you have trouble re-setting your password (or receive a database error when trying" & _
"to sign-in), just FORWARD this email to so we can reactivate your license."
'Use this to send the Email using the HTML Format
'.HTMLBody = "<HTML><H2><b>This is HTML Text in the BODY of the email</b></H2></HTML>"
.HTMLBody = "<HTML><Head></Head><Body><img SRC=\\cvty.com\dfs\Data\PFFS-BSU\Mark\DBs\Ascend\Logo.jpg></Body></HTML>" & vbNewLine & vbNewLine & "NOTE:" & _
"Some of you have may have been deactivated for 12+ months" & _
"of non-use. If you have trouble re-setting your password (or receive a database error when trying" & _
"to sign-in), just FORWARD this email to so we can reactivate your license."
.Importance = olImportanceHigh 'High importance
.Display
End With
'Cleanup Code
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
Set objOutlookRecip = Nothing
Set objOutlookAttach = Nothing