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.
Double-check your file name. Word 2007 uses 4 character file extensions, so it probably changed to *.docm. Cliff Edwards
*.dotm for macro-enabled templates... Cliff Edwards