Rather disgusted with the labyrinth that Outlook forces one to go through to get to user templates, I searched and found some code on TechRepublic that was supposed to achieve this, but something just ain't workin' for me here...
As it was not specified where to place the code I created a module and stuck the following in that:
Sub OpenCustomTemplate()
'Open template from a macro button
'added to the ribbon.
Set myFolder = Session.GetDefaultFolder(olFolderInbox)
Set myItem = myFolder.Items.Add("IPM.Form.Introduction")
myItem.Display
End Sub
where introduction.oft is the name of the saved template. Since I have no background in writing vba for Outlook, I presume that we do not need the ".oft" extension here as the author of the original code said nothing about it in his example and excluded any extensions. I find that strange, but just following the expert.
So I am here because when I assigned this macro to a group I created, it seems to do absolutely nothing.
Can someone bring me up to speed with what I need do to make this menu-borne shortcut function properly?
edit:
OK, I found that the following actually works:
Sub MakeItem()
Dim NewItem As Outlook.MailItem
Set NewItem = Application.CreateItemFromTemplate("C:\Users\bem\AppData\Roaming\Microsoft\Templates\Introduction.oft")
NewItem.Display
Set NewItem = Nothing
End Sub
but is there anything that I can use to replace hard coding the full path to where my templates are stored? I could not find anything that starts with "olFolder" that said "Templates"!
Hmmmmmm. I see I was mixing Outlook and Word. That's what I get for staring at my screen all day long. Sorry!
Of course, IF there is a Word pointer to the templates folder, THAT is what I would like to know about!
Bookmarks