BrainDiseasee
New Member
- Joined
- Aug 30, 2023
- Messages
- 22
- Office Version
- 365
- Platform
- Windows
Hello,
I am trying to write a code that will send an email with a specified body as a string in this code its dim as strbody and i want the the HTMLBODY to include my outlook signature. I can only get on or the other to work but never both at the same time. The code sample below is just displaying an email with my HTML outlook signature but not the strbody.
Sub SendStatus()
Dim OutApp As Object
Dim Outmail As Object
Dim strbody As String
Dim name As String
Dim status As String
Dim Email As String
Dim Project As String
Dim Tollgate As String
Dim ws As Worksheet
' With Application
' .EnableEvents = False
' .ScreenUpdating = False
' End With
Set OutApp = CreateObject("Outlook.Application")
Set Outmail = OutApp.CreateItem(0)
Set ws = ActiveSheet
Project = ws.Cells(21, 3).Text
name = ws.Cells(39, 8).Text
Email = ws.Cells(39, 9).Text
strbody = "Hello" & Project & ", <p> Project Status has been updated."
On Error Resume Next
With Outmail
.to = Email
.CC = ""
.BCC = ""
.Subject = "Project Status Update: " & Project & " " & Format(Date, "mm-dd-yy")
.HTMLBody = strbody & .HTMLBody
.Display
End With
On Error GoTo 0
Set Outmail = Nothing
Set OutApp = Nothing
End Sub
I am trying to write a code that will send an email with a specified body as a string in this code its dim as strbody and i want the the HTMLBODY to include my outlook signature. I can only get on or the other to work but never both at the same time. The code sample below is just displaying an email with my HTML outlook signature but not the strbody.
Sub SendStatus()
Dim OutApp As Object
Dim Outmail As Object
Dim strbody As String
Dim name As String
Dim status As String
Dim Email As String
Dim Project As String
Dim Tollgate As String
Dim ws As Worksheet
' With Application
' .EnableEvents = False
' .ScreenUpdating = False
' End With
Set OutApp = CreateObject("Outlook.Application")
Set Outmail = OutApp.CreateItem(0)
Set ws = ActiveSheet
Project = ws.Cells(21, 3).Text
name = ws.Cells(39, 8).Text
Email = ws.Cells(39, 9).Text
strbody = "Hello" & Project & ", <p> Project Status has been updated."
On Error Resume Next
With Outmail
.to = Email
.CC = ""
.BCC = ""
.Subject = "Project Status Update: " & Project & " " & Format(Date, "mm-dd-yy")
.HTMLBody = strbody & .HTMLBody
.Display
End With
On Error GoTo 0
Set Outmail = Nothing
Set OutApp = Nothing
End Sub