H
H
hesy2018-11-01 16:28:38
VBScript
hesy, 2018-11-01 16:28:38

Data entry outside the file, what is the reason?

Dim fso, MyFile, str, newStr, num, i
i = 0
Set fso = CreateObject("Scripting.FileSystemObject") 
Set MyFile=fso.OpenTextFile("data.txt", 1, True) 
Do While MyFile.AtEndOfStream<>True 
str = MyFile.ReadLine
If (Len(str) <> 0) Then
'str = split(MyFile.ReadLine, ":")
newStr = split(str, "/rus/")
num = UBound(newStr)
i = i + 1
Msgbox newStr(num)

End If

Loop

Swears on line 9:
newStr = split(str, "/rus/")
Data entry outside the file

The line is NOT empty, I broke my whole head.
What could be the reason?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor_Ya, 2021-05-02
@Igor_Ya

This is a variable change error by another process. You may not have closed the FileSystemObject stream.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question