FrancoisStev
02-21-2015, 12:37 AM
I am writing a VBA program that puts a list of commands in a .txt file. These commands are used in a program called xfoil to do calculations for me and puts the results in an output.txt file.
I made a Run.bat file that when I click on it executes perfectly and do everything I want it to do. The problem I am having is that when I use the Shell command in vb then there briefly appears a window saying specified file not found and then nothing happens.
Private Sub CommandButton1_Click()
FileNum = FreeFile
Open "C:\Users\Francois\Desktop\New folder\Input.txt" For Output As #FileNum
Print #FileNum, "naca1012"
Print #FileNum, "plop"
Print #FileNum, "G"
Print #FileNum, ""
Print #FileNum, "OPER"
Print #FileNum, "VISC 245000"
Print #FileNum, "pacc"
Print #FileNum, "Out.txt"
Print #FileNum, ""
Print #FileNum, "a 5"
Print #FileNum, "pacc"
Print #FileNum, ""
Print #FileNum, "Quit"
Close #FileNum
Call Shell("C:\Users\Francois\Desktop\New folder\Run.bat", 1)
End Sub
Can someone please help?
I made a Run.bat file that when I click on it executes perfectly and do everything I want it to do. The problem I am having is that when I use the Shell command in vb then there briefly appears a window saying specified file not found and then nothing happens.
Private Sub CommandButton1_Click()
FileNum = FreeFile
Open "C:\Users\Francois\Desktop\New folder\Input.txt" For Output As #FileNum
Print #FileNum, "naca1012"
Print #FileNum, "plop"
Print #FileNum, "G"
Print #FileNum, ""
Print #FileNum, "OPER"
Print #FileNum, "VISC 245000"
Print #FileNum, "pacc"
Print #FileNum, "Out.txt"
Print #FileNum, ""
Print #FileNum, "a 5"
Print #FileNum, "pacc"
Print #FileNum, ""
Print #FileNum, "Quit"
Close #FileNum
Call Shell("C:\Users\Francois\Desktop\New folder\Run.bat", 1)
End Sub
Can someone please help?