View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Why does this hang up?

Try dimension statemet for RowCount. Declare it a long.

Dim RowCount as Long

"Fan924" wrote:

Why does this hang up? It works on 16k files. Not on 32k and above. It
loads about 200 lines and then seems go get stuck in a loop.

Dim FileType As String
If FileType = "bin" Then
Const ForReading = 1, ForWriting = 2, ForAppending = 3
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
Dim fs, f, ts, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(FileName)
Set ts = f.OpenAsTextStream(ForReading, TristateUseDefault)
ColumnCount = 3
RowCount = 2
Do While ts.atendofstream = False
Hexbyte = Asc(ts.Read(1))
Cells(RowCount, ColumnCount) = Hex(Hexbyte)
RowCount = RowCount + 1
Loop
ts.Close
MsgBox "bin"
Else
End If
End Sub