Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
I have this sub that alows me to open the program PackLaunch from Excel. The problem is that I have only one license of this program and I need to open it only one time. if the program is already open I need to exit from this sub. the problem is that the sub executes the if twice and I do not know why. Public Sub OpenPLaunch() Dim appPack As String Dim BoPack As Boolean On Error Resume Next appPack = "C:\Program Files\PLaunch\PLaunch.exe" Shell appPack If Err < 0 Then BoPack = True ' if no error PLauch is open Err.Clear MsgBox "PLaunch is not open" appPack = "C:\Program Files\PLaunch\PLaunch.exe" Shell appPack Exit if Else MsgBox "found PLauch open" Exit Sub End If End Sub Any help is kindly appreciated Ina |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Not sure why or how it executes the If twice but the following may well run
twice because you have written it twice - Shell appPack " Exit if " is invalid and the "Exit Sub" is redundant Regards, Peter T "ina" wrote in message oups.com... Hello, I have this sub that alows me to open the program PackLaunch from Excel. The problem is that I have only one license of this program and I need to open it only one time. if the program is already open I need to exit from this sub. the problem is that the sub executes the if twice and I do not know why. Public Sub OpenPLaunch() Dim appPack As String Dim BoPack As Boolean On Error Resume Next appPack = "C:\Program Files\PLaunch\PLaunch.exe" Shell appPack If Err < 0 Then BoPack = True ' if no error PLauch is open Err.Clear MsgBox "PLaunch is not open" appPack = "C:\Program Files\PLaunch\PLaunch.exe" Shell appPack Exit if Else MsgBox "found PLauch open" Exit Sub End If End Sub Any help is kindly appreciated Ina |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
So Should I remote Shell appPach Exit Sub
but if the file is not open I need to open it again? Ina |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Launch Program then load file | Links and Linking in Excel | |||
script to launch a program from excel | Excel Discussion (Misc queries) | |||
can vb from excel launch another program? | Excel Worksheet Functions | |||
How to launch one XLA from another on Excel launch | Excel Programming | |||
Macro launch - Button vs Manual launch , has different results. | Excel Programming |