Hi,
When running the following code, the application stops
reacting when executing the line with 'InvokeMember
("Open", ...)'. Why? If someone could point me in the
right direction, I would appreciate it.
private void button1_Click(object sender,
System.EventArgs e)
{
Type wordAppType = Type.GetTypeFromProgID
("Word.Application");
object wordApp = Activator.CreateInstance
(wordAppType);
object wordDocs = wordAppType.InvokeMember
("Documents", BindingFlags.GetProperty, null, wordApp,
new object []{});
object file = @"C:\Test.doc";
object[] openArgs = new Object[] {file};
object WordDoc = wordAppType.InvokeMember("Open",
BindingFlags.InvokeMethod, null, wordDocs, openArgs);
openArgs = new object[] {true};
wordAppType.InvokeMember("Visible",
BindingFlags.SetProperty, null, wordApp, openArgs);
}