Hello. I am running the following script in a excel:
Shell ("mprog.exe outfile.txt") On Error Resume Next Do Until Len(Dir("junk.tmp")) > 0 FileCopy "outfile.txt", "junk.tmp" DoEvents Loop Kill "junk.tmp" On Error GoTo 0 Open "outfile.txt" For Input As #1
The idea is to run an external program, which produces an output file which excel then opens and reads. I was having a problem that excel was trying to access the file while it was still being closed by the shell'd program, hence the delay loop (as per: http://support.microsoft.com/kb/147392). By waiting until teh file could be copied, the program is waiting until it is written and closed. The problem is that it still does not work. I get a "Permission Denied" error when I try to open the file. Any suggestions?