Reply to Email with Template Pictures in Signature not Displaying.

lharr28

New Member
Joined
May 22, 2024
Messages
25
Office Version
  1. 365
Platform
  1. Windows
I'm using the macro below to reply to emails through Outlook but the picture in my signature is not displaying correctly. There is a red x in place of the picture when the reply email populates. How can I get the picture (which is my signature) to display correctly?

1725470844557.png



VBA Code:
Sub ReplywithJournal()

    Dim origEmail As MailItem
    Dim replyEmail As MailItem
    
    Set origEmail = Application.ActiveWindow.Selection.Item(1)
    '**The reply with your template
    Set replyEmail = Application.CreateItemFromTemplate("C:\Users\carl22\OneDrive - phantom\Documents\Templates\Outlook\Journal Submitted.oft")
    
    replyEmail.To = origEmail.Sender
    replyEmail.CC = origEmail.CC
    replyEmail.Subject = origEmail.Subject
    
    replyEmail.HTMLBody = replyEmail.HTMLBody & origEmail.Reply.HTMLBody
    replyEmail.Display
    
End Sub
 

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.
Paste the following in a regular module :

VBA Code:
Option Explicit

Sub SimpleOutlookEmailDisplayRunFromExcelOrOutlookWithTextSignature()
  'This assumes that Outlook is already open to simplify the code
 
  Dim OutApp As Object
  Dim OutMail As Object
  Dim sEmailBody As String
  Dim sSignature As String
 
 
 'Attempt to create an Outlook object
  On Error Resume Next
  Set OutApp = GetObject(, "Outlook.Application")
  If Err.Number <> 0 Then
    Err.Clear
    MsgBox "NOTHING DONE.  The Outlook Object could not be created from Excel." & vbCrLf & _
           "Try again when Outlook is open."
    Exit Sub
  End If
  On Error GoTo 0
 
  'Create the Email Body
  sEmailBody = _
      "This is line one of the email body." & vbCrLf & _
      "This is line two.  " & _
      "This is a continuation of line two."
 
 
  'Create the Outlook Mail Object
  Set OutMail = OutApp.CreateItem(0)
 
  'Grab the Signature
  OutMail.display
  sSignature = OutMail.body
 
  'Determine the values to be sent
  With OutMail
    .To = ""
    .CC = ""
    .BCC = ""
    .Subject = "Info Request"
    .body = sEmailBody & vbCrLf & sSignature
      
    .display
    '.Send - comment out the 'Display line' if you want to send
  End With
 
  'Clear the Object Pointers
  Set OutMail = Nothing
  Set OutApp = Nothing

End Sub

Function GetTextSignatureAsFirstNameForOutlook(OutApp As Object) As String
 
 Dim myNamespace As Object
 Dim iPos As Long
 Dim sUserName As String
 
 Set myNamespace = OutApp.Application.GetNamespace("MAPI")
 
 'Get the 'User Name'
 'Parse at the 'First Space'
 sUserName = Trim(myNamespace.CurrentUser)
 iPos = InStr(sUserName, " ")
 If iPos > 0 Then
   sUserName = Left(sUserName, iPos - 1)
 End If
 
 'Set the Return Value
 GetTextSignatureAsFirstNameForOutlook = sUserName
 
End Function

Instructions from Outlook 'How to include a signature with image'

Include or change a signature in outgoing messages


Add a signature to messages​


You can set a default signature to be added to all your outgoing messages, or you can insert a signature manually into outgoing messages on an individual basis. Do one of the following:


  • Insert a signature automatically​

    1. In a new message, on the Message tab, in the Include group, click Signature, and then click Signatures.
      Note You can also access the signature options that are available on the Message tab after you click Reply, Reply to All, or Forward in an open message.
    2. On the E-mail Signature tab, in the Select signature to edit list, select the signature that you want.
    3. Under Choose default signature, in the New messages list, select the signature that you want.
    4. If you want to include a signature in message replies and in forwarded messages, in the Replies/forwards list, select the signature. If not, select none.
    5. Click OK.
    6. To add the default signature to a currently open message, on the Message tab, in the Include group, click Signatures, and then select the signature.
  • Insert a signature manually​

    1. In a new message, on the Message tab, in the Include group, click Signature, and then select the signature that you want.
      Note You can also access the signature options that are available on the Message tab after you click Reply, Reply to All, or Forward in an open message.
 
Upvote 0
Paste the following in a regular module :

VBA Code:
Option Explicit

Sub SimpleOutlookEmailDisplayRunFromExcelOrOutlookWithTextSignature()
  'This assumes that Outlook is already open to simplify the code
 
  Dim OutApp As Object
  Dim OutMail As Object
  Dim sEmailBody As String
  Dim sSignature As String
 
 
 'Attempt to create an Outlook object
  On Error Resume Next
  Set OutApp = GetObject(, "Outlook.Application")
  If Err.Number <> 0 Then
    Err.Clear
    MsgBox "NOTHING DONE.  The Outlook Object could not be created from Excel." & vbCrLf & _
           "Try again when Outlook is open."
    Exit Sub
  End If
  On Error GoTo 0
 
  'Create the Email Body
  sEmailBody = _
      "This is line one of the email body." & vbCrLf & _
      "This is line two.  " & _
      "This is a continuation of line two."
 
 
  'Create the Outlook Mail Object
  Set OutMail = OutApp.CreateItem(0)
 
  'Grab the Signature
  OutMail.display
  sSignature = OutMail.body
 
  'Determine the values to be sent
  With OutMail
    .To = ""
    .CC = ""
    .BCC = ""
    .Subject = "Info Request"
    .body = sEmailBody & vbCrLf & sSignature
     
    .display
    '.Send - comment out the 'Display line' if you want to send
  End With
 
  'Clear the Object Pointers
  Set OutMail = Nothing
  Set OutApp = Nothing

End Sub

Function GetTextSignatureAsFirstNameForOutlook(OutApp As Object) As String
 
 Dim myNamespace As Object
 Dim iPos As Long
 Dim sUserName As String
 
 Set myNamespace = OutApp.Application.GetNamespace("MAPI")
 
 'Get the 'User Name'
 'Parse at the 'First Space'
 sUserName = Trim(myNamespace.CurrentUser)
 iPos = InStr(sUserName, " ")
 If iPos > 0 Then
   sUserName = Left(sUserName, iPos - 1)
 End If
 
 'Set the Return Value
 GetTextSignatureAsFirstNameForOutlook = sUserName
 
End Function

Instructions from Outlook 'How to include a signature with image'

Include or change a signature in outgoing messages


Add a signature to messages​


You can set a default signature to be added to all your outgoing messages, or you can insert a signature manually into outgoing messages on an individual basis. Do one of the following:


  • Insert a signature automatically​

    1. In a new message, on the Message tab, in the Include group, click Signature, and then click Signatures.
      Note You can also access the signature options that are available on the Message tab after you click Reply, Reply to All, or Forward in an open message.
    2. On the E-mail Signature tab, in the Select signature to edit list, select the signature that you want.
    3. Under Choose default signature, in the New messages list, select the signature that you want.
    4. If you want to include a signature in message replies and in forwarded messages, in the Replies/forwards list, select the signature. If not, select none.
    5. Click OK.
    6. To add the default signature to a currently open message, on the Message tab, in the Include group, click Signatures, and then select the signature.
  • Insert a signature manually​

    1. In a new message, on the Message tab, in the Include group, click Signature, and then select the signature that you want.
      Note You can also access the signature options that are available on the Message tab after you click Reply, Reply to All, or Forward in an open message.
Thanks for your help. This works for just populating a new email. The macro I used is to respond to emails sent to me (reply messages). The macro works, I'm just trying to figure out how to get my signature to populate instead of the red x box. My signature is already saved in outlook but it is in jpeg format. Any help with that? Thanks.
 
Upvote 0
From the Outlook HELP file :

Include or change a signature in outgoing messages


  1. To add a picture, place your insertion point where you want the picture to appear in the signature text, click Insert Picture, browse to an image, click to select it, and then click Insert.

Look in your Outlook HELP file and do a search for insert image signature. Plenty of info and instructions in the HELP file.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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