hi! i want to open a word document directly from a windows form application running on visual studio 2010!
i tried a particular code but it wont work!!!
this is the code!

this.Application.Documents.Open(@"C:\Test\NewDocument.doc");

i also imported and used the following header:

using Microsoft.Office.Interop.Word;

it says that the word application does not exists!
Can anyone help me out with this

thanks in advance!

Recommended Answers

All 5 Replies

hi! i want to open a word document directly from a windows form application running on visual studio 2010!
i tried a particular code but it wont work!!!
this is the code!

this.Application.Documents.Open(@"C:\Test\NewDocument.doc");

i also imported and used the following header:

using Microsoft.Office.Interop.Word;

it says that the word application does not exists!
Can anyone help me out with this

thanks in advance!

Did you check if Word is installed on the particular computer? And you can always use Process.Start to start a program/open a document. Here is some more information about how to open a word document in C#: http://omegacoder.com/?p=555

yes i have installed word 2010
the link you gave me
visual studio errors under application,document and selection saying that you can use it as an instatnce

thanks it worked i used a different code!

So what was the code? Are you not going to help others?

Try using this:

System.Diagnostics.Process.Start("Your file path (including file name with file extention");
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.