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

11 comments:

  1. Anonymous4:58 AM

    Most excellent! Thank you very much!!

    ReplyDelete
  2. Anonymous8:02 AM

    In the words of Borat,
    "Very Nice!"

    ReplyDelete
  3. aaaaaa10:22 PM

    Is it possible to stop process but never close excel workbook

    ReplyDelete
    Replies
    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.

      Delete
  4. Anonymous11:27 PM

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

    ReplyDelete
    Replies
    1. Anonymous12:32 AM

      Eh. What? Is that irony?

      Delete
  5. Anonymous12:30 PM

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

    ReplyDelete
  6. Anonymous6:21 AM

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

    ReplyDelete
  7. Anonymous2:10 AM

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

    ReplyDelete
  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.

    ReplyDelete
    Replies
    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.

      Delete

StumbleUpon
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

microsoft.public.vsnet.vstools.office Google Group