我正在使用 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