SpiderFlight
Programmer
I hope I have the right forum for this question. I have a VBscript that is called from a VB app. The VBscript opens and writes/appends the data to a file. My issue is the vbscript is executed many times within a loop and sends the output to a file, however I receive permission denied errors to the file. I suspect this is because the file is opened for output the first time and hasn't yet finished before the next iteration of the loop calls the vbscript again and tries to write/append data to the same file. Is there a way to have either the vbscript or vb6 app. wait until the file is available for writing? Below is the vbscript code that is executed for your reference.
Set fso = CreateObject("Scripting.FileSystemObject")
Set fileInput = fs
penTextFile(txtInputFile, ForReading, True)
If not flagAppend Then
Set fileOutput = fs
penTextFile(txtOutputFile, ForWriting, True)
Else
Set fileOutput = fs
penTextFile(txtOutputFile, ForAppending, True)
End If
TIA
Set fso = CreateObject("Scripting.FileSystemObject")
Set fileInput = fs
If not flagAppend Then
Set fileOutput = fs
Else
Set fileOutput = fs
End If
TIA