Opening MS Outlook Template With Excel VBA

RunTime91

Active Member
Joined
Aug 30, 2012
Messages
262
Hello ~ Hello

I'm using the following to try and open a saved Outlook Email Template - But I can't escape RunTime 438: "Object Doesn't support this property or method"
Code:
Dim MyItem As Outlook.MailItem
Set MyItem = Application.CreateItemFromTemplate("C:\Users\ABC1234\Desktop\Untitled\*.msg")
Set MyItem = Application.CreateItemFromTemplate("C:\Users\ABC1234\Desktop\Untitled\*.oft")
MyItem.Display

I have invoked the MS Outlook Reference Library - And this seems like it should work - but clearly I'm missing something

EDIT: I have two templates saved one as an .MSG and the other as an .OFT and I am just trying both extensions to see if I can get one to work

Thanks in advance...
 
Last edited:

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Domenic

MrExcel MVP
Joined
Mar 10, 2004
Messages
19,753
With a reference set to Microsoft Outlook Object Library, try...

Code:
Dim olApp As Outlook.Application
Dim olMail As Outlook.MailItem


Set olApp = New Outlook.Application


Set olMail = olApp.CreateItemFromTemplate([COLOR=#333333]"C:\Users\ABC1234\Desktop\Untitled\sample.oft"[/COLOR])


olMail.Display

Hope this helps!
 

Forum statistics

Threads
1,143,907
Messages
5,721,439
Members
422,362
Latest member
elliotpat

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
Top