1
我正在使用excel vba讀取二進制文件,然後將字節獲取爲字節數組。然而得到標超出範圍的異常,在線路13獲取下標超出字節數組的範圍
Sub GetBinaryData()
Dim aryBytes() As Byte
Dim bytInput As Byte
Dim intFileNumber
Dim intFilePos
intFileNumber = FreeFile
Open "Binary.bin" For Binary As #intFileNumber
intFilePos = 1
While Not EOF(intFileNumber)
Get #intFileNumber, intFilePos, bytInput
aryBytes(intFilePos) = bytInput
ReDim aryBytes(UBound(aryBytes) + 1)
intFilePos = intFilePos + 1
Wend
Close #intFileNumber
End Sub
非常感謝Alex – Suresh