Opening MS Outlook Template With Excel VBA

RunTime91

Active Member
Joined
Aug 30, 2012
Messages
276
Office Version
  1. 365
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

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
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!
 
Upvote 0

Forum statistics

Threads
1,214,392
Messages
6,119,257
Members
448,880
Latest member
aveternik

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
Back
Top