Question Locked

VBScript - Expected Loop

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I've a little script that checks for the existence of a file share and if it exists checks for the most recent file. I'm running into an expected Loop error within one area of the code and am hoping someone can give me a hand. The error appears after the If statement starts but before the Else. I tried adding a Loop prior to the Else but that gave a syntax error.

Do Until objFile.AtEndOfStream
shelfPath = objFile.ReadLine
i = i + 1
WshNetwork.MapNetworkDrive driveLetter, shelfPath
If Err.Number <> 0 Then objCreateFile.Write(shelfPath + " can't be reached")
Else
call checkShelf
End If
Loop

3 replies

by danekan

what is objCreateFile? not enough info provided by you, or perhaps the obvious problem if this is your complete script is you haven't defined objCreateFile.

by dogknees

Put a return at the end of the word "Then".

ie
If Err.Number <> 0 Then
objCreateFile.Write(shelfPath + " can't be reached")
Else

This discussion is closed to new replies.