check for running exe

  • Thread starter Thread starter L3Tech
  • Start date Start date
L

L3Tech

In vba, I need to check to see if a program is running on the computer.
If it is not, I need to start the program. The program is not a MS program.
What happens is this. When I start my computer, it automatically starts
a program called link.exe
I have another program that hides the icon for link.exe so it doesn't
get shutdown by anyone, but sometimes it does get shutdown by the user
if they go to the task manager. I have a scheduler that runs my excel
macro once a day and it needs to have link.exe running already or it
fails. I want to check to see whether it is running already from my vba
code and if not, then start it so the macro will run error free.
Any help in doing this?
 
Thought it worked, but it doesn't see the program because it is hidden
by another program that hides icons.
 
You can Use WMI...........
If you are running
Currently, WMI is included when you install;
Microsoft® Windows® 2000,
Windows XP,
Windows Millennium Edition (Me).

For those running Windows 95 OSR 2, Windows 98 or Microsoft® Windows
NT® 4.0, a WMI installation package can be downloaded from Microsoft®
MSDN® which offers similar functionality as WMI in Windows 2000,
Windows XP, and Windows Me
See here for info http://www.xcelfiles.com/WMI_index.html

Then try this;

NOTE: You will need to check in your Task manager for the programs
porper name.


Sub IsProcessRunning()
Dim objList As Object

Set objList = GetObject("winmgmts:") _
.ExecQuery("select * from win32_process where name='link.exe'")

MsgBox "link.exe " & IIf(objList.Count <> 0, " Is ", " Is NOT") & "
running"

Set objList = Nothing

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top