- Код: Выделить всё
Option Explicit
Private Sub Command1_Click()
Dim fso As New FileSystemObject
Dim ts As TextStream
Dim i As Long
Dim sTimer As Single
Set ts = fso.OpenTextFile("C:\temp1.txt", ForAppending, True)
sTimer = Timer
For i = 0 To 100000
ts.WriteLine CStr(i)
Next i
Debug.Print Timer - sTimer
Set ts = Nothing
Open "C:\temp2.txt" For Append As #1
sTimer = Timer
For i = 0 To 100000
Print #1, CStr(i)
Next i
Debug.Print Timer - sTimer
Close #1
Open "C:\temp3.txt" For Append As #1
sTimer = Timer
For i = 0 To 100000
Print #1, i
Next i
Debug.Print Timer - sTimer
Close #1
End Sub
0,8901367
0,171875
0,2971191
Не буду пользоваться FSO (или просто не умею?)