jjkh58
New Member
- Joined
- Apr 21, 2021
- Messages
- 8
- Office Version
- 365
- 2013
- 2011
- 2010
- Platform
- Windows
- Mobile
- Web
Hi guys,
I am trying to add my Outlook signature that has an image with text (i.e. HTML format) and refer specific cell (i.e. .HTMLBody = Range ("B5"). Value) using Macro to return the Outlook Signature with Email body text that is written on cell B5.
I used Ron de Bruin's code (Insert Outlook Signature in mail) but it never seems to be working.
My current code is written below which is the original Ron de Bruin's code but without even making any modifications none of the text is strbody works. The only things that work are the values I specified in ".To", "Subject" and my Outlook Signature (with the correct company logo and text).
So my questions are:
1. How to make the text that I put after "strbody" working
2. Then, I would like to make something like .strbody = Range("B5").Value so that without typing all the email body text directly into Macro, I want Macro to refer to the text that I wrote in cell B5 for the email body.
Please help
Sub Mail_Outlook_With_Signature_Html_1()
' Working in Office 2000-2016
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strbody = "<H3><B>Dear Customer Ron de Bruin</B></H3>" & _
"Please visit this website to download the new version.<br>" & _
"Let me know if you have problems.<br>" & _
"<A HREF=""Excel for Windows Tips"">Ron's Excel Page</A>" & _
"<br><br><B>Thank you</B>"
On Error Resume Next
With OutMail
.Display
.To = "ron@debruin.nl"
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.HTMLBody = strbody & "<br>" & .HTMLBody
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
I am trying to add my Outlook signature that has an image with text (i.e. HTML format) and refer specific cell (i.e. .HTMLBody = Range ("B5"). Value) using Macro to return the Outlook Signature with Email body text that is written on cell B5.
I used Ron de Bruin's code (Insert Outlook Signature in mail) but it never seems to be working.
My current code is written below which is the original Ron de Bruin's code but without even making any modifications none of the text is strbody works. The only things that work are the values I specified in ".To", "Subject" and my Outlook Signature (with the correct company logo and text).
So my questions are:
1. How to make the text that I put after "strbody" working
2. Then, I would like to make something like .strbody = Range("B5").Value so that without typing all the email body text directly into Macro, I want Macro to refer to the text that I wrote in cell B5 for the email body.
Please help
Sub Mail_Outlook_With_Signature_Html_1()
' Working in Office 2000-2016
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strbody = "<H3><B>Dear Customer Ron de Bruin</B></H3>" & _
"Please visit this website to download the new version.<br>" & _
"Let me know if you have problems.<br>" & _
"<A HREF=""Excel for Windows Tips"">Ron's Excel Page</A>" & _
"<br><br><B>Thank you</B>"
On Error Resume Next
With OutMail
.Display
.To = "ron@debruin.nl"
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.HTMLBody = strbody & "<br>" & .HTMLBody
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub