Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2014-01-16
2
Medium Priority
?
5,397 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 53

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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
Are you looking for the options available for exporting EDB files to PST? You may be confused as they are different in different Exchange versions. Here, I will discuss some options available.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

971 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