Wednesday, May 06, 2009

Kill Residual Excel Process using VBA

Here is a simple VBA code to "Kill" the Excel process using VBA

Sub Kill_Excel()

Dim sKillExcel As String

sKillExcel = "TASKKILL /F /IM Excel.exe"
Shell sKillExcel, vbHide

End Sub


  1. Anonymous4:58 AM

    Most excellent! Thank you very much!!

  2. Anonymous8:02 AM

    In the words of Borat,
    "Very Nice!"

  3. aaaaaa10:22 PM

    Is it possible to stop process but never close excel workbook

    1. Anonymous12:35 AM

      It does what the title says it does, don't expect more!
      Save, close the workbook programaticly and set your object to nothing or whatever. Then kill the residual Excel.exe process. What I do not understand is why the process is still there and this kind of brute force kill is nessasary to begin with! I have removed all add ins in Excel. This seems to be a known common problem even up to Excel 201. I havent tested Excel 2013 yet.

  4. Anonymous11:27 PM

    That is strange. Once the process gets killed the Application is no more in Memory

    1. Anonymous12:32 AM

      Eh. What? Is that irony?

  5. Anonymous12:30 PM

    Works Great - Thank You.
    I've been fighting with this problem for days . . . .

  6. Anonymous6:21 AM

    Thanks a lot ;) was looking for something to kill excel while running PPT VBA code.
    Again :) THANKS :))

  7. Anonymous2:10 AM

    Fantastic solution, but what if the user has other sessions of excel open that they don't want closed?

  8. Anonymous1:03 AM

    dude, this is not working for me. Is it because of excel 2010 version since i can see for others it is exact solution. Please reply soon.

    1. Anonymous12:30 AM

      that code works perfectly on my Excel 2010. Shame you didn't provide any details of what "not working" means exactly.

  9. Hi
    This code kill all open excel files how to kill only one particular file


Share on Facebook
Related Posts Plugin for WordPress, Blogger...

Visual Basic for Applications (VBA) Forum (recent threads)

CodeKeep VBA Feed

Visual Studio Tools for Office Forum (recent threads)

Download Windows Live Toolbar and personalize your Web experience! Add custom buttons to get the information you care about most.

Office Business Applications (OBA) Team Blog

MSDN Code Gallery Published Resources For Tag VSTO Google Group