# Opening MS Outlook Template With Excel VBA



## RunTime91 (May 15, 2019)

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"

```
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...


----------



## Domenic (May 15, 2019)

With a reference set to Microsoft Outlook Object Library, try...


```
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!


----------



## RunTime91 (May 16, 2019)

Brilliant!! That did the trick!

Thank You so much, Domenic~!


----------



## Domenic (May 16, 2019)

You're very welcome!

Cheers!


----------

