hi,
here is the code to open the word document.
add a COM reference to your project by right clicking in the solution explorer on References->Add Reference
Click on the COM tab and look for the Microsoft Word 9.0 Object Library
just declare the line below in your class:
- private Word.ApplicationClass WordApp = new Word.ApplicationClass();
-
-
-
if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
-
{
-
object fileName = openFileDialog1.FileName;
-
object readOnly = false;
-
-
object isVisible = true;
-
object missing = System.Reflection.Missing.Value;
-
WordApp.Visible = true;
-
-
Word.Document aDoc = WordApp.Documents.Open(ref fileName, ref missing,ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible);
-
-
aDoc.Activate();
-
-
}
regards,
Began.