Anteckning
Åtkomst till den här sidan kräver auktorisering. Du kan prova att logga in eller ändra kataloger.
Åtkomst till den här sidan kräver auktorisering. Du kan prova att ändra kataloger.
For office developers, you might want to check is there any existing active document is opened before you open a document template.
What you can do is, check is there any open by using (Globals.ThisAddIn.Documents.Count > 0). Then close the activeDocument using ActiveDocument.Close(ref object, ref object, ref object) .
Here is the snippet code that for your reference:
object miss = Type.Missing;
object readOnly = false;
if (Globals.ThisAddIn.Documents.Count > 0)
{
      Globals.ThisAddIn.Application.ActiveDocument.Close(ref miss, ref miss, miss);
}
Word.Document docNew = Globals.ThisAddIn.Application.Documents.Open(ref filePath, ref miss, ref readOnly, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss);
docNew = Globals.ThisAddIn.Application.ActiveDocument;
Comments
Anonymous
December 10, 2007
PingBack from http://www.absolutely-people-search.info/?p=5562Anonymous
December 10, 2007
For office developers, you might want to check is there any existing active document is opened before