View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Elie[_2_] Elie[_2_] is offline
external usenet poster
 
Posts: 5
Default opening text file triggers vb error

Merk-

Thanks for your reply. logFileName changes but in this case is equal
to "d:\Users\Elie\exp11\KeptPromises0-359.txt" .

I am new to vb in general so I don't know the technical deatils of
file opnening and closing. However, if the macro crashed in the middle
of the below loop (brought up a runtime error and I stopeed the
execution) before I had the goto statement, and the file was not
properly closed in the code, would that leave #1 open? If so what
needs to be done.

"Merkling, wrote in message ...
What is logFileName equal to?

Is #1 still open from a previous operation?

-Merk

11/25/03 10:56AM


On Error GoTo SNAFU
Open logFileName For Input As #1
For i = 0 To numPerms
Line Input #1, textLine
If (x) Then
values = Split(textLine, Chr(9))

On Error GoTo SNAFU
With STARTCELL
For xx = 0 To mapSize - 1
.Offset(i - 1, map(xx).Text).Value = values(xx + 1)
Next xx
End With

Else
x = True
End If
Next i

Close #1

Exit Sub
SNAFU:
MsgBox "There was one or more problems with the file ", _
vbCritical, "Data Read Error (-201)"