M
Mike
Hi! I am trying to open a blank Word 2003 document based on a custom template.
I am getting "Word cannot attach a document to a protected template" error.
Here's my code:
object missing = System.Reflection.Missing.Value;
Word.ApplicationClass wordApp = new Word.ApplicationClass();
Word.Document newDoc = wordApp.Documents.Add(ref missing, ref missing, ref
missing, ref missing);
newDoc.Range(ref missing,ref missing).Text = "Test";
object templateName = (object)@"C:\MyTemplate.dot";
newDoc.set_AttachedTemplate(ref templateName); // breaks here
wordApp.Visible = true;
I am getting "Word cannot attach a document to a protected template" error.
Here's my code:
object missing = System.Reflection.Missing.Value;
Word.ApplicationClass wordApp = new Word.ApplicationClass();
Word.Document newDoc = wordApp.Documents.Add(ref missing, ref missing, ref
missing, ref missing);
newDoc.Range(ref missing,ref missing).Text = "Test";
object templateName = (object)@"C:\MyTemplate.dot";
newDoc.set_AttachedTemplate(ref templateName); // breaks here
wordApp.Visible = true;