How to attach word template (.DOT) in Ms Office 2007 through VBA C

A

Arpit

Problem:
Want to Attach the word template with all its macroS, which was created in
msword 2003, in MSOffice-2007 word document through VBA code.

Problem Facing:

I had already created a template 'xyz.dot' which contains few macros also,in
msword 2003 and save it in C:\template\xcz.dot.

but now we are using msoffice 2007.

To open a word document template in my application,I had written VBA code to
attached a template.

below is following code:

- - - -
- - - -

ActiveDocument.UpdateStylesOnOpen = False
ActiveDocument.AttachedTemplate = "C:\template\xcz.dot"
ActiveDocument.XMLSchemaReferences.AutomaticValidation = True
ActiveDocument.XMLSchemaReferences.AllowSaveAsXMLWithoutValidation =
False

- - -
- - -


Got an OLE Automation ERROR "Command Failed" during the execution of code
line -- ActiveDocument.AttachedTemplate ="C:\template\xcz.dot"


Required:
Now we are using MSOFFICE 2007 so I need to open ,the word template + with
all its defined macros, which was created in MSOFFICE-2003, through VBA code.
 
W

ward376

Double-check your file name. Word 2007 uses 4 character file
extensions, so it probably changed to *.docm.

Cliff Edwards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top