VBA Code for Signature in email - Funy things happen?

dcharland

New Member
Joined
Mar 2, 2011
Messages
40
Wondering if anyone understands why this is happening?

I'm sending an email with excel VBA using a template file (.oft) because this allows me to set other variable like (e.i. request read receipt) in the template instead of the code. Also allows me to set different templates for different needs.

But when:

  1. I use .display the signature from the template is there
  2. I use .send the signature from the template is gone!!!
  3. I use the combination of .display, wait 2 seconds, .send the signature is there?
Below is my VBA code


The Code
HTML:
Sub smail()
 Dim OutApp As Object
    Dim OutMail As Object
    Dim cell As Range
    Dim txt As String
    
    txt = "This is the body of the email"
    
    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.createItemFromtemplate("C:\Users\dcharland\Information Meeting.oft")
    With OutMail
         .To = "dcharland@live.com" ' Write the recepient email
         .Subject = "This is the Subject" 'Writes the subject line
         .HTMLBody = txt
         .Display ' Signature is there!
         ' Application.Wait (Now + TimeValue("0:00:02")) ' Put a 2 second delay between sending each emails
        ' .Send ' this combination works.
         '.Send ' only Signature is Gone?
    End With
    
    
End Sub
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Forum statistics

Threads
1,224,581
Messages
6,179,668
Members
452,936
Latest member
anamikabhargaw

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