I have a script that will fire once an hour. In this script txt files are created. The next time the script fires, it may or may not create another file (with the same name). However I am getting an permission denied error. I believe this to be because the original file is still open even though the script has finished executing. I can't figure out why the txt file will still be open for editing when I have closed it and cleared out all of the variables from memory. Any help at all would be appreciated. My code for creating the file is below:
Can anyone see anything that would keep the txt file open even after the script is done executing?
If (InStr(ErrorCode,"already exists!")=0) AND (Len(ErrorCode)>0) AND (InStr(ErrorCode,"Invalid Offer!")=0) Then
'WRITING SOAPMessage to Text File so we can see what the error is
logfile.writeline OrderID & " - Unknown Error See Order Folder for Details"
strOutputFile2="C:/LogFiles/" & Cust & "/OrderFiles/"& OrderID &".txt"
Dim OrderFSO, OrderFile
Set OrderFSO = CreateObject("Scripting.FileSystemObject")
Set OrderFile = OrderFSO.CreateTextFile(strOutputFile2, TRUE)
OrderFile.writeLine "Response: " & xmlhttp.status
Set strOutputFile2 = nothing
Set OrderFile = Nothing
Set OrderFSO = Nothing