TASKKILL - terminating/ending/killing a task

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15640
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

TASKKILL - terminating/ending/killing a task

Post by ChrisGreaves »

I have just found and implemented a nifty three-liner from Edward Leno http://stackoverflow.com/questions/3526228/vba-script-to-close-every-instance-of-excel-except-itself

Code: Select all

Dim sKill As String
sKill = "TASKKILL /F /IM msaccess.exe"
Shell sKill, vbHide
Of course, I couldn't resist adapating it:

Code: Select all

Sub CloseApplication(strApplication As String)
' http://stackoverflow.com/questions/3526228/vba-script-to-close-every-instance-of-excel-except-itself
    Dim sKill As String
    sKill = "TASKKILL /F /IM " & strApplication
    Shell sKill, vbHide
'Sub TESTCloseApplication()
'    Call CloseApplication("winamp.exe")
'End Sub
End Sub
Winamp has posed a real problem for me. I use Winamp (from Word VBA) to preview a track before renaming or deleting the file. Until this morning I was manually shutting down WinAmp before programmatically issuing the task to rename or delete a task; this saw me getting back into a batch-processing mode of the 60s.
I am running Win7/Office2003.
There's nothing heavier than an empty water bottle

User avatar
HansV
Administrator
Posts: 78530
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: TASKKILL - terminating/ending/killing a task

Post by HansV »

BTW, there is a banner on the WinAmp website:
Winamp.com and associated web services will no longer be available past December 20, 2013. Additionally, Winamp Media players will no longer be available for download. Please download the latest version before that date. See release notes for latest improvements to this last release.
Thanks for supporting the Winamp community for over 15 years.
Best wishes,
Hans

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15640
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: TASKKILL - terminating/ending/killing a task

Post by ChrisGreaves »

(Thanks for the heads-up, Hans.)
HansV wrote:BTW, there is a banner on the WinAmp website
Boo! Hiss!! I shall withdraw my patronage immediately :laugh:

Sad really. I've been using WinAp for yonks, and my little Acer-Aspire runs it non-stop as a jukebox, 24/7, playing my favorite music.
There's nothing heavier than an empty water bottle