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>
 

Some videos you may like

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Forum statistics

Threads
1,089,434
Messages
5,408,202
Members
403,188
Latest member
Sanjana Ramesh

This Week's Hot Topics

  • help please
    SORRY NOT ANY GOOD AT EXCEL SO HELP WOULD BE MUCH APPRECIATED this formula is in a sheet called ignore...
  • two formulas needed
    Hello, I'll try my best to explain this: First formula needed in Sheet1 cell A2: If Sheet1 cell B2 = Sheet2 cell B2 then return a 1. If not then...
  • Dynamic Counts
    Good afternoon, we are tidying up some data & the data seems to be growing quicker than we are tidying it up! What we confirm (by reviewing it...
  • Help Excel formula eliminate duplicate values and keep only 2 identical rows.
    as picture below column A has a duplicate value. but the values are not the same as the rule. sometimes 4 rows, sometimes 10 rows or 7 or 9...
  • Macro Compile Error Sub or Function not defined
    Hello, I am trying to run macros from a validation list, all macros have been created and run perfectly on there own but I'm getting a compile...
  • Last row combined with Current Region VBA
    I'm generally happy finding the last row of data through something like Lastrow = Cells(Rows.Count, "D").End(xlUp) but I don't always receive data...
Top