?
Solved

How do I open and edit an Outlook template file within VBA ?

Posted on 2014-01-16
2
Medium Priority
?
5,835 Views
Last Modified: 2014-01-16
Hi All,

I have an Outlook template file (.oft) which I want to open within an Excel VBA procedure and automatically modify some of the text, depending on a value in my spreadsheet.
How do I do this ?

Regards
Toco
0
Comment
Question by:Tocogroup
2 Comments
 
LVL 55

Accepted Solution

by:
Rgonzo1971 earned 2000 total points
ID: 39785255
Hi,

pls try

Sub xx()

Dim oApp As Object, oMail As Object

 Set oApp = CreateObject("Outlook.Application")
Set oMail = oApp.CreateItemFromTemplate("C:\Users\YouTemplateFile.oft")

With oMail
    strFind = "Code:"
    strNew = "Code:" & Cells(4, 3) ' for example
    .HTMLBody = Replace(oMail.HTMLBody, strFind, strNew)

    .Display

End With

End Sub

Open in new window

Regards
0
 

Author Comment

by:Tocogroup
ID: 39785299
Excellent. Thanks for that.

Toco
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

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.

Join & Write a Comment

Ever faced an issue with Microsoft Outlook? If you’ve been working long enough with this popular emailing platform, you’ve probably faced more than one issue. Like to restore ScanPST.exe .bak file. Here in this post we will discuss the methods to re…
This guide provides step by step instructions on how to convert an Offline(.ost) to a Personal file(.pst). A different situation occurs when a conversion of OST file to PST format is needed. Use the described manual methods and SysTools OST to PST C…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Watch the working video to know how to import Outlook PST/OST files to Amazon WorkMail. Kernel released this tool which is very easy to use and migrate single or multiple PST and OST files to Amazon WorkMail. To know more about Kernel Import PST to …

584 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question