Hi,
I am trying to create a macro that runs a path if it is present, if not it will try the next down down in a list, and so on until it shows an error message if nothing is found. An extract of the code is beneath, but the second on error goto wont work, it just says "File not found" and stops. However the first one works just fine. I am sure that there is a far cleaner way of doing this, but I'm darned if I know it. Any help would be greatly appreciated as I have been mucking about with it for hours.
Private Sub runTxShuttleScript(scriptName As String, xlFile As String, sheetName As String, startRow As String, numRows As String, Optional logColumn As String)
On Error GoTo newshuttle
programm = "c:\program files\winshuttle\txshuttle\txshuttle.exe"
out = Shell(programm & " " & scriptName & xlFile & sheetName & startRow & numRows & logColumn, vbNormalFocus)
exithandler:
Exit Sub
newshuttle:
On Error GoTo newshuttle2
programm = "C:\Program Files\Winshuttle\transactionSHUTTLE8\txshuttle.exe"
out = Shell(programm & " " & scriptName & xlFile & sheetName & startRow & numRows & logColumn, vbNormalFocus)
exithandler2:
Exit Sub
newshuttle2:
On Error GoTo errhandler
programm = "c:\program files\winshuttle\runshuttle8\txrunner.exe"
out = Shell(programm & " " & scriptName & xlFile & sheetName & startRow & numRows & logColumn, vbNormalFocus)
exithandler3:
Exit Sub
errhandler:
MsgBox "This operation can only be run on a computer with XXXXX." & vbNewLine & "You do not have the correct software.", _
vbOKOnly, "No Software Found"
Sheets("Master").Select
End Sub
Bookmarks