Excel keeps running in the background!!

ckmoied

Board Regular
Joined
Oct 13, 2002
Messages
154
I open excel application from VB6 using the following procedure and then close it at the end. Though the application close visibly, it keeps running in the background. After closing the application, I press CTR-ALT-DELETE, and there I can see that excel is still running. Any clues.

Dim objxl As Object
Dim objbook As Object
Set objxl = CreateObject("Excel.Application")
objxl.Workbooks.Add
Set objbook = objxl.ActiveWorkbook

.
.
.
Application.DisplayAlerts = False
objbook.Saved = False
objxl.Quit
Application.DisplayAlerts = True
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
OK .....so the problem was to use WITH statement within the VB code.

I removed the with statment and it solved the problem partially.

Actually I open two excel instances in my code. Now I can close one of them. i.e. after removing WITH statment and then using
objxl.Quit statement.

But the other instance keeps running unless I unload the form. Before removing WITH statment both instances kept on running, but now only one is running. I have thoroughly checked my code to c if there is any other statment that keeps excel running in task manager, but didn't find anything.

Is there a way that I can quit all excel applications without unloading the form. So that VB6 goes to check the task manager, and close any prevailing excel applications.
 
Upvote 0

Forum statistics

Threads
1,216,099
Messages
6,128,822
Members
449,470
Latest member
Subhash Chand

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top