Beruflich Dokumente
Kultur Dokumente
As String
If oFSO.FileExists(fname) Then
Set oFSTR = oFSO.OpenTextFile(fname)
Do While Not oFSTR.AtEndOfStream
lCtr = lCtr + 1
If lCtr = LineNumber Then
ReadLine = oFSTR.ReadLine
Exit Do
End If
oFSTR.SkipLine
Loop
oFSTR.Close
Set oFSTR = Nothing
End If
End Function
If Overwrite Then
Open FileFullPath For Output As #iFileNumber
Else
Open FileFullPath For Append As #iFileNumber
End If
ErrorHandler:
Close #iFileNumber
End Function
Option Explicit
Dim i As Long
i = 0
ReDim Preserve strLines(0 To 800000) As String
End Sub
Public Property Get ReadLines(n As Long, m As Long) As String
Dim buf As String
buf = ""
Dim i As Long
For i = n To m
If i >= n And i <= m Then
buf = buf & strLines(i - 1) & vbCrLf
DoEvents
End If
If i > m Then
ReadLines = buf
Exit Property
End If
Next
ReadLines = buf
End Property
m_sFilePath = pVal
ReadFile
End Property
Public Property Get FileSize() As Long
FileSize = m_lSize
End Property
End Sub
Private Sub WriteFile()
Dim i As Long
i = 0
Dim fso As New Scripting.FileSystemObject
Dim ts As Scripting.TextStream
For i = 0 To m_lines - 1
ts.WriteLine (strLines(i))
Next
ts.Close
End Sub
For i = 0 To m_lines - 1
If (i = posi) Then
ts.WriteLine (str)
End If
ts.WriteLine (strLines(i))
Next
ts.Close
End Sub
Public Sub InsertNewLine(ByVal str As String, ByVal posi As Long)
WriteFileAtPosi str, posi
ReadFile
End Sub
For i = 0 To m_lines - 1
If (i = posi - 1) Then
ts.WriteLine (str)
i = i + 1
End If
ts.WriteLine (strLines(i))
Next
ts.Close
End Sub