?
Solved

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

Posted on 2003-03-12
6
Medium Priority
?
495 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

801 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