Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Mar 2007
    Location
    Wikltshire UK
    Posts
    152
    Thanks
    2
    Thanked 0 Times in 0 Posts

    HTML Templates from Auto Emails (Outlook 2007 (VBA))

    HI

    I'm using the Code below to create an email from an Access VBA Module to send an automatic email with attached content, the "Powers that be" (grrrr) want it sent using an HTML template with embedded Corporate Logo (logo.bmp) and in "Verdana 11pt" etc, do we have a way of doing this or am I trying to do the impossible. If we need to refer to an HTML template I'll need to know how to create/Reference it. Thanks

    ESubject = "Report " & Datet & " AM"
    SendTo = email addresses
    CCTo = email addresses
    Ebody = "Find attached the Morning report for " & Datet
    NewFileName1 = "Cocuments and SettingsadminDesktopreport1 " & Datet & " AM.pdf
    NewFileName2 = "Cocuments and SettingsadminDesktopreport2 " & Datet & " AM.pdf"

    Set App = CreateObject("Outlook.Application")
    Set itm = App.CreateItem(0)
    With itm
    .Subject = ESubject
    .To = SendTo
    .CC = CCTo
    .Body = Ebody
    .Attachments.Add (NewFileName1)
    .Attachments.Add (NewFileName2)
    .Display
    '.send If you want to send without changing
    End With

    Thanks, Any input gratefully received.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: HTML Templates from Auto Emails (Outlook 2007 (VBA))

    Instead of

    Set itm = App.CreateItem(0)

    you can use something like

    Set itm = App.CreateItemFromTemplate("C:TemplatesReport.oft" )

    Report.oft is an Outlook template for an e-mail message with the logo. You create a template by creating a message that looks the way you want, then using File | Save As... to save it as an Outlook template (*.oft).

  3. #3
    2 Star Lounger
    Join Date
    Mar 2007
    Location
    Wikltshire UK
    Posts
    152
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Re: HTML Templates from Auto Emails (Outlook 2007 (VBA))

    Thank-You.

    Seems to Pick up the Font,

    Dosnt seem to pick up the Logo which is at the top of the mail and signature at the Bottom.

    Also can I then Structure the .Body content using HTML IE (p and /p for new Line), because its possible the text is overwriting the logo.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: HTML Templates from Auto Emails (Outlook 2007 (VBA))

    I don't know how Outlook templates work - I never use them.

    Instead of setting the Body property of the mail item you can set the HTMLBody property, for example (from the Outlook VBA help):

    .HTMLBody = "<HTML><H2>My HTML page.</H2><BODY>My body.</BODY></HTML>"

  5. #5
    2 Star Lounger
    Join Date
    Mar 2007
    Location
    Wikltshire UK
    Posts
    152
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Re: HTML Templates from Auto Emails (Outlook 2007 (VBA))

    You are da Man.....................

    Thats a big FAT British yes to your reply........

    Thanks Sorted.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •