Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Problem Closing Excel

Found the solution...tried to close the objects in an excel event...how
should an object destroy it self from the inside...think i have to go to
school again;-)

have a nice day!

"m.ahrens" wrote:

Hi All

I have problems Closing excel...
Excel 2003 / Visual Studio 2003 / C#

The Code I use:

oExcel.WorkbookBeforeSave -= EventDel_BeforeBookSave;
oExcel.WorkbookDeactivate -= EventDel_Deactivate;

PIDHandler.NAR(wSheet);
wBook.Close(false, Type.Missing, Type.Missing);
PIDHandler.NAR(wBook);
PIDHandler.NAR(wBooks);
oExcel.Quit();
PIDHandler.NAR(oExcel);
GC.Collect();
GC.WaitForPendingFinalizers();

static public void NAR(object o)
{
try
{
System.Runtime.InteropServices.Marshal.ReleaseComO bject(o);
}
catch
{
}
finally
{
o = null;
}
}

After Compleating the code above, Excel produces a total crash: "Microsoft
Office Excel has encountered a problem and needs to close. We are sorry for
the inconvenience." You know, this error, where you can send a "Error Report"
to microsoft. What might i be doing wrong?

thanks for your help

m.ahrens

Reply
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
Problem when closing Excel 2007 and with Add-ins Gary Excel Discussion (Misc queries) 1 January 4th 08 01:02 AM
Problem closing Excel David Excel Discussion (Misc queries) 2 January 29th 06 01:02 AM
Problem closing Excel Jim Simpson Excel Programming 2 May 29th 04 06:25 PM
Excel Closing Problem Him_B Excel Programming 4 January 19th 04 07:16 AM
Problem with closing the excel application guhan Excel Programming 1 August 20th 03 01:56 PM


All times are GMT +1. The time now is 12:14 AM.

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

About Us

"It's about Microsoft Excel"