EXCEL 2016 Send an email with signature

christinawang

New Member
Joined
Feb 27, 2016
Messages
3
I need to compose emails using VBA with signature in EXCEL 2016. I followed an tutorial on YouTube. This is the code I used, exactly same as the youtuber's but it works on his computer, not mine.

Sub PrepareEmailNow()
Dim olApp As Outlook.Application
Dim olEmail As Object
Dim sig As String

Set olApp = New Outlook.Application
Set olEmail = olApp.CreateItem(olMailItem)

With olEmail
.BodyFormat = olFormatHTML
.To = "Christina.Y.McDonald@ey.com"
.Subject = "Legal Invoices"
.Display
.HTMLBody = "Cindy," & "<br>" & "I love working here." & .HTMLBody

End With

End Sub

when it comes to the line:
.HTMLBody = "Cindy," & "<br>" & "I love working here." & .HTMLBody,
it throws error 287: application defined or object defined error
I tried other ways, but the signature wont show. C
ould someone here help me? Thank you!
<strike>
</strike>
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

Forum statistics

Threads
1,223,885
Messages
6,175,179
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top