nam
nam

Reputation: 23749

MS Word document not visible when opening programmatically through interop

The following code opens the document in the background but not make it visible even though I am using Visible = true and oDoc.Activate();

using Word = Microsoft.Office.Interop.Word;
Word.Application oApp = new Word.Application();
Word.Document oDoc = oApp.Documents.Open(FileName: @"C:\Folder1\Test1.docx", Visible: true);
oDoc.Activate();

According to this SO post, it should have worked.

Upvotes: 3

Views: 2903

Answers (1)

Eugene Astafiev
Eugene Astafiev

Reputation: 49395

It looks like you forgot to set the Visible property of the Application class.

See How to automate Microsoft Word to create a new document by using Visual C# for more information.

Upvotes: 1

Related Questions