|
|
Построчное чтение (Open ... For Input )
Private Sub esImportTextLineByLyne(sFilePath As String)
Dim FF As Long
Dim i As Long
Dim sLine As String
On Error GoTo esImportTextLineByLyne_Err
If Dir(sFilePath, vbNormal) = "" Then
MsgBox "Не могу найти файл:" & vbCrLf & _
sFilePath, vbCritical
Exit Sub
End If
FF = FreeFile
Open sFilePath For Input As #FF
Do While Not EOF(1)
Line Input #FF, sLine
i = i + 1
Debug.Print "Строка #" & Format(i, "000") & ": " & sLine
Loop
Close #FF
esImportTextLineByLyne_Bye:
Exit Sub
esImportTextLineByLyne_Err:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description & vbCrLf & _
"in procedure esImportTextLineByLyne", vbCritical, "Error!"
Resume esImportTextLineByLyne_Bye
End Sub
|
|