Automate Outlook email creation

I got this from a past question, and I want to alter it a bit.
In another question, an expert had created an HTML template to use that was perfect for my needs.
How can I 'load' that HTML template as my objMail.Body below?

    Dim objNameSpace As Outlook.NameSpace
    Dim objMail As Outlook.MailItem
    Set objOutlookApp = Outlook.Application
    Set objNameSpace = objOutlookApp.GetNamespace("MAPI")
    Set objMail = objOutlookApp.CreateItem(olMailItem)
    objMail.To = ""
    objMail.Subject = "subject"
    objMail.Body = "message"
LVL 67
Who is Participating?
Hi sirbounty,
Add it as an attachment. The "normal" body will be shown in clients that don't support html-mails, all others will display the html file as message :)
objMail.Attachments.Add('Message.html', olByValue, 1, 'Message.Html')

sirbountyAuthor Commented:
I'll have to dig up the old question - before I was given an html template with a variable at the end to 'add' the file list to the end of the email.
I'd still like to be able to do that...
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

You can still add other attachments, that's no problem, just continue calling objMail.Attachments.Add with other files. If you use an html-template, just read it from the file, fill the template in and save it as a temporary file, then attach the file, send the mail + delete the temp. file.
use CDO

see the advice i gave in my first comment in the following thread:

or search the page for "CDO"
you ahve the advantage that it doewsnt say "warning, some program is trying to send mail pretending to be you, do you want to send it?"
sirbountyAuthor Commented:
Thanx to you both - I need a few more days to look over this in combination with my other code to see if I can merge the two...
I appreciate your time. :)
sirbountyAuthor Commented:
Haven't really had much time for this yet, but my scanning will pickup again after the first.
I don't want to leave the thread open that long though, so we'll assume your posts will do it and I'll ask followups later, if needed.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.