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

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Domenic

MrExcel MVP
Joined
Mar 10, 2004
Messages
19,722
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,141,413
Messages
5,706,298
Members
421,440
Latest member
cmphares

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