User1453549677 posted
I picked up this code snippet from MSDN... it's for Word automation from ASP.Net.
The compiler flags an error on the this.Activate(); line. - there is no Activate. I think that the snippet is based upon the Word 10 library dll, I have Word 12. Is there a replacement for
the Activate method?
protected
void Button1_Click(object sender,
EventArgs e)
{
Word.Application wdapp;
//Shell Word
System.Diagnostics.Process.Start(@"C:\Program Files\Microsoft
Office\Office12\WINWORD.EXE");
this.Activate();
//This Word and other Office applications register themselves in
//ROT when their top-level window loses focus. Having a MessageBox
//forces Word to lose focus and then register itself in the ROT.
Label1.Text = "Launched Word";
//Get the reference to Word.Application from the ROT.
wdapp = (Word.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Word.Application");
//Display the name.
Label2.Text = wdapp.Name;
//Release the reference.
wdapp = null;
}