For the life of me, I can't get this shell procedure to work with variables. I'm trying to execute POSTRESULTS6 which then processes the csv file. The "DISPLAY" argument tells POSTRESULTS6 to show a progress window as it processes the csv.
Dim MyAppID As Variant
Dim stExecute As String: stExecute = """C:\Program Files (x86)\PerkinElmer\LABWORKS64\POSTRESULTS6.exe"""
Dim stFile As String: stFile = "INFILE:C:\PostResult6\Multi-Component_Data_Import.csv"
Dim stFull As String: stFull = "stExecute & "" "" & stFile"
MyAppID = Shell("stFull" & "" "" & DISPLAY, vbNormalFocus)
AppActivate (MyAppID)
The procedure works as expected when I type it all out in one single line like this:
MyAppID = Shell("""C:\Program Files (x86)\PerkinElmer\LABWORKS64\POSTRESULTS6.exe"" & "" "" & INFILE:C:\PostResult6\Multi-Component_Data_Import.csv" & "" "" & DISPLAY, vbNormalFocus)
The reason that I want to use variables is to shorten the lines of code and possibly make the procedure dynamic for the csv file name.
I'm guessing that it has something to do with spaces but I can't figure out where my mistake is. I also can't figure out how to continue the long string of code to the next line. The space-underscore doesn't seem to work.
As an aside, when my shell procedure was very simple, I didn't have to declare the MyAppID variable. As it got more complex, I started getting errors about MyAppID not being defined. Does anyone know why this is?
Any help is greatly appreciated.
Edit: The Error that I get when I run the code with variables is "Run-time error '53': File not found"
I know that the file paths assigned to the variables are correct. I tested them in windows explorer.
