ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Test if application running? (https://www.excelbanter.com/excel-programming/318464-test-if-application-running.html)

Chuck

Test if application running?
 
Does Excel have any property similar to Tasks in Word (or object similar to
Task) that allows you to determine whether a particular app is running? I
don't want to activate the window, just determine if the app is running.
Thanks for any help!

Ken Macksey

Test if application running?
 
Hi

Here is some vbscript code that should do what you want. I have found this
code very handy.
I found it on a web site somewhere and do not know the original author.

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colProcesses = objWMIService.ExecQuery( "select * from win32_process" )

isrunning = False

For Each objProcess in colProcesses

If objProcess.GetOwner ( User, Domain ) = 0 Then



msgbox objprocess.caption



If objProcess.caption = "MSIMN.EXE" then ' replace "msimn.exe" with the
objprocess.caption you want to know about
isrunning = true ' then
comment out the msgbox line
End If


End If

Next





if isrunning = true then ' comment out the msgbox lines and
do what you want here
msgbox "Outlook Express is running"
else
msgbox "Outlook Express is not running"
end if



Just use what you need from it.


HTH

Ken




All times are GMT +1. The time now is 07:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com