B
Boris Drajer
Hi,
I have a COM Add-in (written in C#) that works (well... kind of ) in
Excel 2003 and Word 2003. It is connected to a document repository from
which it can download and open files. Now, what I want is to be able to
open both DOC and XLS files from either of the two applications. To be
more clear, here's a simple scenario: I fire up Excel, then click on a
menu which opens my addin's window. There I select a DOC file from a
list. This file is then opened in Word.
So, the first question is: what is the proper way to instantiate Word
(or Excel)? I tried something like this:
using Microsoft.Office.Interop;
Word.ApplicationClass word = new Word.ApplicationClass();
word.Visible = true;
word.Documents.Open(ref filename, ref missing, .... etc ....)
This opens a Word window, but if I do this twice, it causes a conflict
over Normal.dot, so I suppose this is not the proper way. What should I
do? Should I call ShellExecute()? Note that I want to be able to
communicate with the Word instance afterwards.
Thanks in advance!
I have a COM Add-in (written in C#) that works (well... kind of ) in
Excel 2003 and Word 2003. It is connected to a document repository from
which it can download and open files. Now, what I want is to be able to
open both DOC and XLS files from either of the two applications. To be
more clear, here's a simple scenario: I fire up Excel, then click on a
menu which opens my addin's window. There I select a DOC file from a
list. This file is then opened in Word.
So, the first question is: what is the proper way to instantiate Word
(or Excel)? I tried something like this:
using Microsoft.Office.Interop;
Word.ApplicationClass word = new Word.ApplicationClass();
word.Visible = true;
word.Documents.Open(ref filename, ref missing, .... etc ....)
This opens a Word window, but if I do this twice, it causes a conflict
over Normal.dot, so I suppose this is not the proper way. What should I
do? Should I call ShellExecute()? Note that I want to be able to
communicate with the Word instance afterwards.
Thanks in advance!