PDA

View Full Version : Solved: Detecting a Running Application



Opv
03-15-2011, 03:41 PM
How would one code VBA to detect whether C:\Program Files\MyApp.exe is running? Also, if it is running, how would one terminate the application?

mancubus
03-15-2011, 04:02 PM
this may help

http://www.vbaexpress.com/kb/getarticle.php?kb_id=811

mdmackillop
03-15-2011, 04:05 PM
Word has a Tasks method. You can call on this.

Sub Test()
Dim wd As Object
Dim Tsk As String

Tsk = "MyApp.exe"

Set wd = CreateObject("word.application")
If wd.Tasks.Exists(Tsk) Then wd.Tasks(Tsk).Close
wd.Quit
Set wd = Nothing
End Sub

Opv
03-15-2011, 04:09 PM
Thanks a million.

Opv