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.softwarefutures.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.ApplicationClass();
wbook = app.Workbooks.Open("c:\\Book1.xls", System.Reflection.Missing.Value,
System.Reflection.Missing.Value, System.Reflection.Missing.Value,
System.Reflection.Missing.Value, System.Reflection.Missing.Value,
System.Reflection.Missing.Value, System.Reflection.Missing.Value,
System.Reflection.Missing.Value, System.Reflection.Missing.Value,
System.Reflection.Missing.Value, System.Reflection.Missing.Value,
System.Reflection.Missing.Value);
app.Visible = true;
}
private void closeFile()
{
//Close the Application:
wbook.Close(System.Reflection.Missing.Value,
System.Reflection.Missing.Value, System.Reflection.Missing.Value);
app.Workbooks.Close();
app.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComO bject(wbook);
System.Runtime.InteropServices.Marshal.ReleaseComO bject(app);
//aSheet = null;
wbook = null;
app = null;
GC.Collect();
}