V
vincent
Many thanks for your replying.
try
{
// Declaring the object variables we will need later
object varFileName = "c:\\test\\sample.doc";
object varFalseValue = false;
object varTrueValue = true;
object varMissing = Type.Missing;
// Create a reference to MS Word application
Microsoft.Office.Interop.Word.Application varWord = new
Microsoft.Office.Interop.Word.Application();
// Creates a reference to a word document
Microsoft.Office.Interop.Word.Document varDoc =
varWord.Documents.Open(ref varFileName, ref varMissing, ref varFalseValue,
ref varMissing, ref varMissing, ref varMissing, ref varMissing, ref
varMissing, ref varMissing, ref varMissing, ref varMissing, ref varMissing,
ref varMissing, ref varMissing, ref varMissing, ref varMissing);
// Activate the document
varDoc.Activate();
//Please add code here
//CLOSING THE FILE
varDoc.Close(ref varFalseValue, ref varMissing, ref
varMissing);
//QUITTING THE APPLICATION
varWord.Quit(ref varMissing, ref varMissing, ref varMissing);
}
catch (Exception exception)
{
MessageBox.Show(exception.ToString());
}
}
try
{
// Declaring the object variables we will need later
object varFileName = "c:\\test\\sample.doc";
object varFalseValue = false;
object varTrueValue = true;
object varMissing = Type.Missing;
// Create a reference to MS Word application
Microsoft.Office.Interop.Word.Application varWord = new
Microsoft.Office.Interop.Word.Application();
// Creates a reference to a word document
Microsoft.Office.Interop.Word.Document varDoc =
varWord.Documents.Open(ref varFileName, ref varMissing, ref varFalseValue,
ref varMissing, ref varMissing, ref varMissing, ref varMissing, ref
varMissing, ref varMissing, ref varMissing, ref varMissing, ref varMissing,
ref varMissing, ref varMissing, ref varMissing, ref varMissing);
// Activate the document
varDoc.Activate();
//Please add code here
//CLOSING THE FILE
varDoc.Close(ref varFalseValue, ref varMissing, ref
varMissing);
//QUITTING THE APPLICATION
varWord.Quit(ref varMissing, ref varMissing, ref varMissing);
}
catch (Exception exception)
{
MessageBox.Show(exception.ToString());
}
}