Hi, I have VBA code that sends emails on outlook that works fine. However, the sent emails do not contain my logo and signature as set up in out look (even though composing & sending manually on outlook automatically compose and send on logo/signature-ready templates).
Can someone suggest what I need to tweak in the code below to enable my logo and signature to be attached to outgoing mails?
Code:
Sub SendRunRequest()
Dim Msg As String
Dim olApp As Object
Dim olEmail As Object
Dim SendAt As String
Dim SendTo As String
Dim Sendcc As String
Dim Subj As String
Dim resp As Long
Calculate
subje = Range("e24").Value
mes = Range("e26").Value
Tester = Range("e22").Value
ReqCC = Range("e23").Value
SendTo = Tester
Sendcc = ReqCC
Subj = subje
Msg = mes
'SendAt = "10/19/2008 12:30am" 'Date-Time must be in this format
On Error Resume Next
Set olApp = GetObject(, "Outlook.Application")
If Err = 429 Then
Err.Clear
Set olApp = CreateObject("Outlook.Application")
End If
On Error GoTo 0
olApp.Session.Logon
Set olEmail = olApp.CreateItem(olMailItem)
With olEmail
' .DeferredDeliveryTime = SendAt
.To = SendTo
.cc = Sendcc
.Subject = Subj
.Body = Msg
resp = MsgBox(Prompt:="Are you sure you want to send off this email?", _
Buttons:=vbYesNo, Title:="Warning")
If resp = vbYes Then
.Send
MsgBox "Email sent!"
End If
End With
olApp.Session.Logoff
Set olApp = Nothing
Set olEmail = Nothing
End Sub
Can someone suggest what I need to tweak in the code below to enable my logo and signature to be attached to outgoing mails?
Code:
Sub SendRunRequest()
Dim Msg As String
Dim olApp As Object
Dim olEmail As Object
Dim SendAt As String
Dim SendTo As String
Dim Sendcc As String
Dim Subj As String
Dim resp As Long
Calculate
subje = Range("e24").Value
mes = Range("e26").Value
Tester = Range("e22").Value
ReqCC = Range("e23").Value
SendTo = Tester
Sendcc = ReqCC
Subj = subje
Msg = mes
'SendAt = "10/19/2008 12:30am" 'Date-Time must be in this format
On Error Resume Next
Set olApp = GetObject(, "Outlook.Application")
If Err = 429 Then
Err.Clear
Set olApp = CreateObject("Outlook.Application")
End If
On Error GoTo 0
olApp.Session.Logon
Set olEmail = olApp.CreateItem(olMailItem)
With olEmail
' .DeferredDeliveryTime = SendAt
.To = SendTo
.cc = Sendcc
.Subject = Subj
.Body = Msg
resp = MsgBox(Prompt:="Are you sure you want to send off this email?", _
Buttons:=vbYesNo, Title:="Warning")
If resp = vbYes Then
.Send
MsgBox "Email sent!"
End If
End With
olApp.Session.Logoff
Set olApp = Nothing
Set olEmail = Nothing
End Sub