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-itselfCode: 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.