Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Closing Excel from Access VBA Module

Status
Not open for further replies.

maranello

IS-IT--Management
Mar 8, 2001
3
US
Hello everyone...

I am having a problem closeing an instance of Excel from within an Access VBA module. The window disappears, but the Excel process does not. Could someone tell me the correct way to do this?
 
It would be helpful if you post the code that is not working when you ask a question.
Are you Executing the Application.Quit method of the excel oobject? If so are you also using Set ExcelObject = Nothing ? A com object is not removed from memory until its refrence count = 0. Until you set the variable to Nothing your refrence to the object is not released. Ruairi

Could your manufacturing facility benefit from real time process monitoring? Would you like your employees to be able to see up to the minute goal and actual production?
For innovative, low cost solutions check out my website.
 
The code I am using is as follows:

Dim myApp as Excel.Application
set myApp = new Excel.Application
myApp.Visible=True //so I can see it close
...code to read in some data

Then, I have tried the following, none of which work to remove the Excel process from memory...

1. myApp.quit (or close)
2. myApp.Application.quit
3. myApp.Workbooks.close

Then...

set myApp = Nothing

This successfully closes the window, however, the 'Excel' process remains in memory and causes Access to hang. Thank you for your reply, this problem is really bugging me.
 
I never had this problem until I had to add a WorkSheet.Activate command. Now I have the same problem, and the only way I can make it work is to remove the .Activate (but then other things don't work). I did try WorkSheet.Select rather than WorkSheet.Activate, but with the same result. I hope someone out there can help us out. Good luck. -- Ham Rutledge
 
I am having the same issue with the same code. I am interested to see if there is anything suggested from the forum. I have not experienced Access hanging on any of the code or processes, but the instance of Excel in the background will cause resource problems on my user's PCs once I roll out my program.
Bryan Meek
bmeek@pacbell.net
A "Solution Provider" in your corner gives you the personal attention you need to find the right technology solutions for your business.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top