LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Excel Process Hanging ( Interop.Excel)

Hi All

I have a probelm with Excel Automation. I create an Excel Application and
open a workbook. Then I close the workbook and Quit the Excel Application,
but the Excel.exe Process does not disapear...

What am i doing wrong?

Thanks
j.ahrens

My Code:

using System;
using System.Reflection;
using Excel = Microsoft.Office.Interop.Excel;

namespace TestApplication
{
/// <summary
/// Summary description for ExcelTest.
/// </summary
public class ExcelTest
{
[STAThread]
static void Main()
{
//my excel file
string file = @"C:\Tmp\Test.xls";

//Set culture to english-US, otherwise the interop won't work
System.Threading.Thread.CurrentThread.CurrentCultu re = new
System.Globalization.CultureInfo("en-US");

//Create the excel application
Excel.ApplicationClass app = new
Microsoft.Office.Interop.Excel.ApplicationClass();

//Open the workbook
Excel.Workbook wb = app.Workbooks.Open(file, false, true, Missing.Value,
Missing.Value, Missing.Value,
Missing.Value, Missing.Value, Missing.Value, Missing.Value,
Missing.Value, Missing.Value, Missing.Value, Missing.Value,
Missing.Value);

//Close the workbook
wb.Close(false, Missing.Value, Missing.Value);

//Release the workbook com reference
System.Runtime.InteropServices.Marshal.ReleaseComO bject(wb);
wb = null;

//Close the excel application
app.Quit();

//Release the application com reference
System.Runtime.InteropServices.Marshal.ReleaseComO bject(app);
app = null;

System.Threading.Thread.Sleep(5000);
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
GC.WaitForPendingFinalizers();
}
}
}


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel hanging... Jambo Excel Discussion (Misc queries) 1 May 30th 08 03:13 PM
Can you use a hanging indent in an Excel cell? DBTI Excel Discussion (Misc queries) 1 July 8th 05 09:08 PM
Can you use hanging indents in Excel? TPA59 Excel Discussion (Misc queries) 1 June 2nd 05 09:42 PM
Excel hanging up Dave Peterson[_3_] Excel Programming 0 September 9th 04 07:10 PM
Hanging Instances Of EXCEL.EXE? MDW Excel Programming 1 July 9th 04 03:27 PM


All times are GMT +1. The time now is 05:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"