ScriptAddict
asked on
File in use VBS scripting question
Can anyone help me understand why this code isn't waiting for files to be released before trying to rename them?
For each objfile In files
'Test Code begins here
on error resume next
do
Err.Clear
Set fLog = objfso.OpenTextFile(objfile, ForAppending, false)
loop until Err.Number <> 70
on error goto 0
'End Test Code
if right(objfso.getfilename(objfile),3) = "prn" then
objFSO.MoveFile objfile , folder.path & "\" & left(objfso.getfilename(objfile),len(objfso.getfilename(objfile))-3) & "pdf"
end if
Next
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Your right I forgot my
Const ForReading = 1, ForWriting = 2, ForAppending = 8
row!
Thanks!
Const ForReading = 1, ForWriting = 2, ForAppending = 8
row!
Thanks!
Great, glad that helped!
~bp
~bp
ASKER
I'll repost if this doesn't fix it next week.