Is program Running, if Not Run it.

chris186h

Board Regular
Joined
Mar 18, 2015
Messages
111
Hello all,
I have spent some time searching but couldnt come up with an answer.
I would like excel to check on workbook_open if a program called nosleep.exe is running.
If so then continue with the rest of the code if not then run the program c:\nosleep.exe

Many thanks for any help
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Here is a very basic example of checking if Notepad is running, and if not then start the app, which may get you running - there may be better ways of doing this now (think this is from 5 or 6 years ago) - as sometimes the message to show its running takes a little longer than I think it should to appear (excel 2016) :confused:

Code:
Sub IsitRunning()
    On Error GoTo notrunning
    AppActivate ("notepad")
  MsgBox "running"
    Exit Sub
notrunning:
Shell "Notepad.exe", 3 [COLOR="#008000"]'1 normal, 2 minimised, 3 masssssive - full screen[/COLOR]
End Sub
 
Upvote 0
Thankyou for the help. That worked perfectly with notepad but not with the program im running. NoSleep is just a screensaver preventor that runs in the taskbar. I changed it to its name but excel continues to start it every time runing multiple versions. Thankyou for the help anyway very kind
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,304
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top