Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

After quiting excel using objApp.Quit();, 'excel' still appears in the task manager!!

Posted on 2003-03-12
6
Medium Priority
?
513 Views
Last Modified: 2008-10-13
Help anyone,
   
     i am using the excel automation to read and write data.below is how the program goes when i have finished writing and ready to close my excel obj application

    COleVariant VOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
  //Set the range value to the SAFEARRAY.
  range.SetValue(COleVariant(saRet));
  objApp.SetDisplayAlerts(FALSE);
  objSheet.SaveAs(m_csFilename, VOptional, VOptional,
               VOptional,VOptional,VOptional,
                VOptional, VOptional,VOptional);
                                 
  //close the safearray
   saRet.Detach();
  saRet.Destroy();
  objApp.SetVisible(FALSE);
               
 //to prevent having more than 1 excel in task manager
  objApp.SetUserControl(TRUE);    
       
  m_bStartRecording = FALSE;
  ReadRecordCount=0;
  TRACE("m_bStartRecording == FALSE......end of recording");


 range.ReleaseDispatch();
  objBook.Close(COleVariant((short)FALSE), VOptional, VOptional);
objBook.ReleaseDispatch();
 objBook = NULL;
          //exits excel
                           
  objApp.Quit();    
  objApp.ReleaseDispatch();
     objApp=NULL;

However after running the program above to close the excel file, the excel program still exist in the task manager.it is only upon closing my dialog box, the excel file no longer exist in the task manager.

the problem is crucial to me because i would like to open and read the excel file which i recorded data without the need to close my dialog box. concurrently this is not possible because there exist a ghost excel file in the task manager that stops me from opening other excel files.

0
Comment
Question by:xiuxiu
5 Comments
 

Accepted Solution

by:
sudipta_pal earned 100 total points
ID: 8125248
   hi
     try this code to close the active work book.

     excel_app.ActiveWorkbook.Close True
     excel_app.Quit
     Set excel_sheet = Nothing
     Set excel_app = Nothing
and tell me what happs.
0
 
LVL 5

Assisted Solution

by:dc197
dc197 earned 100 total points
ID: 8127983
objApp.Quit();    
 objApp.ReleaseDispatch();

This is no good.  First line closes, then you are asking the (closed) objApp to perform a method call.

Just use objApp.Quit
0
 

Expert Comment

by:CleanupPing
ID: 8900187
xiuxiu:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 9664612
Moderator, my recommended disposition is:

    Split points between: sudipta_pal and dc197

DanRollins -- EE database cleanup volunteer
0
 
LVL 5

Expert Comment

by:dc197
ID: 9665443
Hear hear!
;-)
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question