Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

HTML Body

0

I am new to VBA, but I am using this code that you made to send emails and I altered just a little bit to cell locations.  I would like to use HTML format in the body or the possibility to change colors of text or make letters bold. etc.  of the email even if I have to make the body in the vba code.  If possible, I would also like to include a few cells as a table in the excel body of the email.  Basically, this is the code so far:

Sub Email_From_Excel_Attachments()

Dim emailApplication As Object

Dim emailItem As Object

Set emailApplication = CreateObject("Outlook.Application")

Set emailItem = emailApplication.CreateItem(0)

' Now we build the email.

emailItem.to = Range("P1").Value

emailItem.CC = Range("P2").Value

emailItem.BCC = Range("P3").Value

emailItem.Subject = Range("P4").Value

emailItem.Body = Range("P5").Value

' Attach current Workbook

'emailItem.Attachments.Add ActiveWorkbook.FullName

' Attach any file from your computer.

'emailItem.Attachments.Add ("C:\test\test.xlsx")

' Send the Email

emailItem.Display

Set emailItem = Nothing

Set emailApplication = Nothing

End Sub

Answer
Discuss



Answer the Question

You must create an account to use the forum. Create an Account or Login