I currently have a spreadsheet that I use to generate mass e-mails that I can format using HTML and it works really well. One thing that I have not been able to figure out is whether or not there is a way to also incorporate CSS styling within an HTML e-mail created through excel.
Has anyone tried this/had success with this before?
My current subroutine uses the Outlook Application to construct material into an HTML email. The code for calling/constructing is:
Sub Test_Email(what_address As String, subject_line As String, mail_body_message As String)
Dim olApp As Outlook.Application
Dim oAttatch As Outlook.Attachment
Set olApp = CreateObject("Outlook.Application")
Dim olMail As Outlook.MailItem
Set olMail = olApp.CreateItem(olMailItem)
With olMail
.To = what_address
.Subject = "My Subject"
.BodyFormat = olFormatHTML
.HTMLBody = mail_body_message
'mail_body_message is all text that resides in Cell A1 and it consists of body text of the email as well as the HTML tags that I use to organize the message display
.Display
End With
End Sub
Within cell A1, I have all of my message information. Starts with and ends with <HTML> </HTML>
and then my message body resides within the tags. So far, when I have tried to insert CSS styles within the existing HTML in cell A1, it spits out the HTML just fine but treats the CSS as text.