Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

call shell.. need to execute program but only if not yet running

Status
Not open for further replies.

maudedo

MIS
Jul 10, 2003
41
GB
current code:
Private Sub Form_DblClick(Cancel As Integer)

Dim stAppName As String

stAppName = "C:\program files\microsoft office\office\EXCEL.EXE"
Call Shell(stAppName, 1)

end sub

however, i only want this to run if the file is not currently open on this machine.. how can i stop multiple versions of excel running?

the string i have used is just to test the function, an inhouse exe file will run once i get the code right..
 
If this is an app you have the source to (VB), you can add the following code to the form load procedure.

If app.PreviousInstance = True Then End
 
Have you looked into using the FindWindow API?

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top