l is set to 2k, 2*1024. this is the buffer size, ie: how much to load in each go
strFile is the name of the file to open.
Dim l as long, sz as long
Dim FN As Integer
Dim strFile As String, c As String
FN = FreeFile
Open strFile For Binary Access Read As #FN
l = 2 * 1024: c = Space$(l) ' 2k Buffer Size, 2 * 1024
sz = LOF(FN)
If sz / l Then
For d = 1 To sz / l
Get #FN, , c
MsgBox c
Next
End If
' load remainder of file, if filesize is not exactly divisable by l (2k)
l = sz Mod l
If l Then
c = Space$(l)
Get #FN, , c
MsgBox c
End If
Close #FN
The data loaded is returned in variable
c
. Do whatever you like with it..
Comments