Killing Ghost Excel processes

zealot777

Board Regular
Joined
Nov 9, 2006
Messages
135
Hi,
I am running a macro in Matlab which leaves the 5 ghosts excel.exe processes running after each macro loop - I have 168 loops - so it builds up a lot.I wanted to ask if there is a way to close all instances of excel.exe - other than the active master workbook from which the macros are running?Or excel processes can be differentiated by size (less than 100 lbs) or less than minute older.
Thanks a hope it is possible!
Dave
 
Last edited:

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Dave

Have you checked why you are ending up with ghost processes?
 
Upvote 0
Upvote 0
Dave

I can post some Powershell code to kill all Excel processes, is that the sort of thing you are looking for?
 
Upvote 0
Dave

I can post some Powershell code to kill all Excel processes, is that the sort of thing you are looking for?

sweet - can i envoke this code from vba? and kill only processes smaller than 100 mbs? that woudl be perfect!
 
Upvote 0
Sorry, not had time to reply - actually thought I had some code kicking about but I can't find it.

I'll try and post something later.
 
Upvote 0
Here's PowerShell code that will kill any Excel processes that are using less than 10MB.
Code:
$processes_to_kill = get-process |

    where { $_.PM -le 10MB  -and $_.path -like "*excel.exe"}

if ($processes_to_kill -ne $null)

{

    $processes_to_kill | foreach { $_.Kill() }

}
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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