title: Inserting Signature into Outlook email from Excel VBA
body: <p>I am trying to automate some emails using VBA for Excel. Everything so far is fine, except trying to keep my signature in the email.</p>
  
  <p>Once you tell VBA to create a new email, it will already contain your default signature. This can be seen if you try <code>Outmail.Display</code>. However if you overwrite the <code>.HTMLBody</code> property, it will be deleted.</p>
  
  <p>My simple attempt was to save the contents of <code>.HTMLBody</code> to a <code>signature</code> (string), and then reassign it to <code>.HTMLBody</code> just to test it out. However the resulting email will be void of any signature.</p>
  
  <p>Code to copy and re-insert the signature:</p>
  
  <pre><code>Dim myOlApp As Outlook.Application
  Dim MyItem As Outlook.MailItem
  
  Dim signature As String
  
  
  Set myOlApp = CreateObject("Outlook.Application")
  Set Outmail = myOlApp.CreateItem(0)
  
  signature = Outmail.HTMLBody
  Outmail.HTMLBody = signature
  
  Outmail.Display
  </code></pre>
  
  <p>Code to show that signature is automatically inserted:</p>
  
  <pre><code>Dim myOlApp As Outlook.Application
  Dim MyItem As Outlook.MailItem 
  Set myOlApp = CreateObject("Outlook.Application")
  Set Outmail = myOlApp.CreateItem(0)
  Outmail.Display
  </code></pre>
  
  <p>Edit: I tried replacing <code>.HTMLBody</code> with <code>.Body</code>. That works, but obviously takes out the HTML formatting of the signature</p>
  
  <p>Edit 2: The code works on my friend's computer but not on mine</p>