Hi,
I'm opening and closing an excel using C#. Once the file has been opened and
closed I then double click on the file with Windows Explorer and excel opens
and then just hangs.
Can anyone help?
Thanks
Garth
ga************* @cpt.softwarefu tures.com
Below is the platform and source code that I'm using.
My platform:
Excel 2000
..Net 2003
Windows 2000 Server
Source Code:
(Note I've made a COM reference to the Excel 9.0 Object Library)
private void openFile()
{
//Open the application
app = new Excel.Applicati onClass();
wbook = app.Workbooks.O pen("c:\\Book1. xls", System.Reflecti on.Missing.Valu e,
System.Reflecti on.Missing.Valu e, System.Reflecti on.Missing.Valu e,
System.Reflecti on.Missing.Valu e, System.Reflecti on.Missing.Valu e,
System.Reflecti on.Missing.Valu e, System.Reflecti on.Missing.Valu e,
System.Reflecti on.Missing.Valu e, System.Reflecti on.Missing.Valu e,
System.Reflecti on.Missing.Valu e, System.Reflecti on.Missing.Valu e,
System.Reflecti on.Missing.Valu e);
app.Visible = true;
}
private void closeFile()
{
//Close the Application:
wbook.Close(Sys tem.Reflection. Missing.Value,
System.Reflecti on.Missing.Valu e, System.Reflecti on.Missing.Valu e);
app.Workbooks.C lose();
app.Quit();
System.Runtime. InteropServices .Marshal.Releas eComObject(wboo k);
System.Runtime. InteropServices .Marshal.Releas eComObject(app) ;
//aSheet = null;
wbook = null;
app = null;
GC.Collect();
}