Monday, April 27, 2009

How to Kill the Word Process using VBA

Developers who are working on Word VBA would have experienced the Word Crash problem more often.

Here is a crude way to kill the Word process.
Sub Kill_Word()

Dim sKillWord As String

sKillWord = "TASKKILL /F /IM Winword.exe"

Shell sKillWord, vbHide

End Sub

Process Window

Use this option if you are sure that the process is unused one


  1. Anonymous2:05 AM

    Thank you
    You saved the day

  2. Thanks! This was exactly what I needed.

  3. Anonymous11:51 AM

    Doesn't work for me in XP get a 53 error message

    1. Anonymous9:05 PM

      53 means file not found, so winword.exe is probably already closed.

  4. Anonymous3:13 AM

    u saved my life, finally that works... ty :)

  5. thankyou! thankyou! thankyou!
    however, if you are running this in excel you may wait to put a wait in after it. I make mine wait 5 secs and everything works fine afterwards


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