Monday, June 30, 2008

Getting the object of Running office Application

If you want to use the running excel object. You can use the following function:

private void getExcelApp()
{
try
{
objXlApp = (excel.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application");
}
catch
{
objXlApp = new excel.Application();
}
}

No comments: