Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outlook98 - Opening Word File

Status
Not open for further replies.

SHardy

Programmer
May 9, 2001
231
GB
I have an Outlook98 application for which I am putting together a new print function. In order to get
a presentable print, I have set up a Word97 template and I am passing the field values to a document
based on this template.

I have been working with the template in one of my network folders. However, this will be required by
people in many locations, using different servers. I'd rather not have to distribute the template and
instruct people to place it in specific directories.

What I would like to do is publish the template into one of the public Exchange folders, and start a
document based on this template.

I have been using this method to create the document previously:

Set oDoc = oWordApp.Documents.Add("C:\Filename.dot")

What would I need to do to use the template in the public folder?
 
As an alternative, just incase it's not possible for Word to use a template from an Exchange folder, is there a way I code do the following from my Outlook code:

1) Copy the Word template file from the Exchange folder to the root of the local drive.
2) Create the document based on the template on the local drive.
3) Discard the new document without saving.
4) Delete the template from the local drive.

This, also, would ensure that ALL users:
1) Have access to the template.
2) Are always using the latest template, in the event ofany amendments.
 
Have boshed something together using my alternative method:

:
:
Set MyNameSpace = Application.GetNameSpace("MAPI")
Set MainPublicFolder = MyNameSpace.Folders("Public Folders")
Set AllPublicFolders = MainPublicFolder.Folders("All Public Folders")
Set PublicCCFolder = AllPublicFolders.Folders("JMC - IT Change Control")
Set PrintTemplate = PublicCCFolder.Items("Change Control Record.dot")

PrintTemplate.Attachments.Item(1).SaveAsFile "C:\Change Control Record.dot"
Set oWordDoc = oWordApp.Documents.Add("C:\Change Control Record.dot")
oWordDoc.Unprotect
:
:

Seems to do the trick, but if any one can help with the original question it would be most appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top