0

I have a Fortran routine which reads the data from a file, processes the data, and records the results in few *.csv files. It has perfectly worked for years. Now I made a VBA Excel Macro which prepares the data files, calls the Fortran routine

TemporFile = Directory & "\" & "VTFeV4.exe"
Call Shell(TemporFile, 0)

, and forms an Excel workbook using the *.csv files generated by the Fortran routine VTFeV4.exe. The problem is, it doesn't work consistently. Sometimes, the resulting files do not appear, the VBA Macro indeed canot find the file, and interrups. The Windows' Start Task Manager shows that the EXE file is still running. (Please note, "Directory" is the correct Path). I found that if to run the Macro stepwisely (F8), it works better. So I added time delay

Dim PauseTime, Start, Finish, TotalTime
PauseTime = pt 
Start = Timer
Do While Timer < Start + PauseTime
    DoEvents
Loop

which worked well with pt=10 until TODAY (02/22/17) when it stopped working at all even when pt=20s though the EXE file works well and fast (apparently much quicker than 10s, less to say!). I also tried

ABC = Shell(Directory & "\NewVTF1.exe", 1)

with same result. What is the problem with Shell? Please help!

Community
  • 1
  • 1
Boris
  • 1

0 Answers0