0

I have been programming add-in for Microsoft Office Word. I need to open an existing document in a new window Word. How can I do this?

Deduplicator
  • 44,692
  • 7
  • 66
  • 118
Ateist
  • 137
  • 2
  • 11
  • 2
    I think you can use it like here: http://stackoverflow.com/questions/16253215/open-and-modify-word-document –  Oct 15 '13 at 06:13
  • Thank you, but this method only works if the first document is edited (or not empty). Otherwise, a second document opens in the first window. – Ateist Oct 15 '13 at 06:26
  • link shared by Sven should work, can you share your code – Brijesh Mishra Oct 15 '13 at 07:23

1 Answers1

0

try this code, if it is achieved your requirement,else please ask.

 public void OpenExistDoc(string docName)
    {
        object fileName = docName;
        object oMissing = Type.Missing;
        this.Application.Documents.Open(ref fileName, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing
            , oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing);
    }


 private void ThisAddIn_Startup(object sender, System.EventArgs e)
    {
        this.OpenExistDoc("your file");
    }
Ram Nivas
  • 142
  • 3
  • 13