using Word = Microsoft.Office.Interop.Word; Word.Application wdapp; System.Diagnostics.Process.Start("<Path to WINWORD.EXE>"); this.Activate(); wdapp = (Word.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Word.Application"); MessageBox.Show(wdapp.Name); wdapp = null;
object word; try { word = System.Runtime.InteropServices.Marshal.GetActiveObject("Word.Application"); } catch (COMException) { Type type = Type.GetTypeFromProgID("Word.Application"); word = System.Activator.CreateInstance(type); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)