EXCEL.EXE is not getting killed
-
I am working on Excel automation using VC++(unmanaged). Following are the two issues: 1. Whenever Excel is closed , Excel.EXE is not getting closed. My application should track opening and closing of Excel. I released application pointer(Excel::_ApplicationPtr) but same problem. I googled and got few solutions, but nothing worked. I tried : Excel::_ApplicationPtr XL. XL->Quit(); XL->Release(); XL = NULL; but none of these worked. 2. Is there any callback which tracks excel.exe is closed? Please give me clue to solve these issues. Regards, KTTransfer.
-
I am working on Excel automation using VC++(unmanaged). Following are the two issues: 1. Whenever Excel is closed , Excel.EXE is not getting closed. My application should track opening and closing of Excel. I released application pointer(Excel::_ApplicationPtr) but same problem. I googled and got few solutions, but nothing worked. I tried : Excel::_ApplicationPtr XL. XL->Quit(); XL->Release(); XL = NULL; but none of these worked. 2. Is there any callback which tracks excel.exe is closed? Please give me clue to solve these issues. Regards, KTTransfer.
Just try this - Set the 'Visible' property to TRUE and then call Quit method. -- Its a guess, if not worked, you may have to find the EXCEL process and terminate the process using TerminateProcess function.
-
I am working on Excel automation using VC++(unmanaged). Following are the two issues: 1. Whenever Excel is closed , Excel.EXE is not getting closed. My application should track opening and closing of Excel. I released application pointer(Excel::_ApplicationPtr) but same problem. I googled and got few solutions, but nothing worked. I tried : Excel::_ApplicationPtr XL. XL->Quit(); XL->Release(); XL = NULL; but none of these worked. 2. Is there any callback which tracks excel.exe is closed? Please give me clue to solve these issues. Regards, KTTransfer.
-
I am working on Excel automation using VC++(unmanaged). Following are the two issues: 1. Whenever Excel is closed , Excel.EXE is not getting closed. My application should track opening and closing of Excel. I released application pointer(Excel::_ApplicationPtr) but same problem. I googled and got few solutions, but nothing worked. I tried : Excel::_ApplicationPtr XL. XL->Quit(); XL->Release(); XL = NULL; but none of these worked. 2. Is there any callback which tracks excel.exe is closed? Please give me clue to solve these issues. Regards, KTTransfer.
It must have something to do with the way you are accessing Excel's type library. I've got several Excel automation projects that close Excel just fine. The only difference is that they don't use the
#import
directive. The one that does use#import
simply callsapp->Quit()
."One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
It must have something to do with the way you are accessing Excel's type library. I've got several Excel automation projects that close Excel just fine. The only difference is that they don't use the
#import
directive. The one that does use#import
simply callsapp->Quit()
."One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
Again see below... I have had this error before. I have code to controls add-in installation to avoid warnings from one xla referencing another. // The following line is necessary to be sure that app object is released when we finish, because // the Garbage Collector is non-deterministic and by default can leave app unreleased. System::GC::Collect(); System::GC::WaitForPendingFinalizers(); //GetActiveObject Error is this line is excluded
-
Again see below... I have had this error before. I have code to controls add-in installation to avoid warnings from one xla referencing another. // The following line is necessary to be sure that app object is released when we finish, because // the Garbage Collector is non-deterministic and by default can leave app unreleased. System::GC::Collect(); System::GC::WaitForPendingFinalizers(); //GetActiveObject Error is this line is excluded
This is managed code. I think the OP is using unmanaged code.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
This is managed code. I think the OP is using unmanaged code.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
Then are you using the following? //Release the no-longer-needed IUnknown... if (pUnk) pUnk->Release(); //... Add your automation code for Excel here ... //Release pDisp when no longer needed... if (pDisp) pDisp->Release(); //Cleanup COM... CoUninitialize();
-
Then are you using the following? //Release the no-longer-needed IUnknown... if (pUnk) pUnk->Release(); //... Add your automation code for Excel here ... //Release pDisp when no longer needed... if (pDisp) pDisp->Release(); //Cleanup COM... CoUninitialize();
Ted2102 wrote:
Then are you using the following?
No, I use smart pointers whenever possible.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
It must have something to do with the way you are accessing Excel's type library. I've got several Excel automation projects that close Excel just fine. The only difference is that they don't use the
#import
directive. The one that does use#import
simply callsapp->Quit()
."One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
Then instead of #import what else we can use to include? I tried making it visible and then used quit but no use. It's not getting killed.
-
This is managed code. I think the OP is using unmanaged code.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
If you don't want to bother with this kind of problems in managed world, you should take a look at GemBox.Spreadsheet .NET Excel library. It is lightweight library for reading and writing XLS, XLSX, ODS, CSV and HTML files, and it doesn't use Excel Interop.