SUZUKI
robertdeniro said:
-*Shell "C:\windows\ap1.exe", vbNormalFocus*-
Thanks a lot.
Your answer is very helpfull and now I can exute "Ap1.exe" from VBA.
Another question arose in using function "shell".
How can I make VBA program wait until Ap1.exe terminates its execution.
Ap1.exe will operate automatically; it will calculate, output the result
to a text file, close the result file, and then terminate its execution
automatically.
It takes about 1 second for an execution of Ap1.exe.
I want to let VBA program wait before proceeding to Line4.
I want to read the result file written by Ap1.exe and process by VBA.
It is needed to repeat this cycle so many times.
---------------------------------------------------------------
Sub test1
Line1: FOR I=1 TO 1000
Line2: cells(1,1)="starting Ap1.exe" ' displaying cell "A1" in Excel
worksheet
Line3: Shell "C:\windows\ap1.exe", vbNormalFocus
Line4: cells(1,1)="terminated execution of Ap1.exe"
Line5: call read_calculation_result_file
Line6: call process_calculation_result
Line7: NEXT I
End Sub
---------------------------------------------------------------