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 dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

attaching a template with word

Status
Not open for further replies.

sajidi99

Programmer
Jun 7, 2005
53
SE
Hello experts,

I am trying to attached a template (.dot file) using the following code below in C#, but its not working as expected.

if (Doc != null && sTemplateFile != "")
{
object CustomizationContext = sTemplateFile;
Doc.set_AttachedTemplate(ref CustomizationContext);
}
_WordApp.Activate();
_WordApp = null; // get rid of our reference as Word itself is now open and the user
// will close manually

why I am importing the template:
================================
There are some "custom built menus" in the template file which I want to be imported to the new word document, whenever this template file is attached to it. So that whenever user creates a new word document, it aleady has the custom built menus (that would come from the template file, if it had attached succeffully .. but its not!).

The problem is:
===============
It does not attach the template file and new menus dont appear!

Any help would be great
Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top