ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How can I read/write file with binary format??? (https://www.excelbanter.com/excel-programming/299623-how-can-i-read-write-file-binary-format.html)

NC

How can I read/write file with binary format???
 
I have a problem of read/write binary file.

When I use the following statement


Dim Ar(5) As Byte
Ar(0) = 1
Ar(1) = 3
Ar(2) = 5
Ar(3) = 6
Ar(4) = 7
Open "Test.bin" For Binary Access Write As #1
For i = 0 To 4
Write #1, Ar() ' <--- Error found
Next
Close #1

How can I read/write with binary file???

NC



DNF Karran[_16_]

How can I read/write file with binary format???
 
Shouldn't
For i = 0 To 4
Write #1, Ar() ' <--- Error found
Next

be
For i = 0 To 4
Write #1, Ar(i) ' <--- Error found
Next

?

Dunca

--
Message posted from http://www.ExcelForum.com


NC

How can I read/write file with binary format???
 
Duncan,

Thanks for your help! This is only typing mistake.

I have found the solution, using Put/Get instead of Write/Input

NC

"DNF Karran " ¦b¶l¥ó
¤¤¼¶¼g...
Shouldn't
For i = 0 To 4
Write #1, Ar() ' <--- Error found
Next

be
For i = 0 To 4
Write #1, Ar(i) ' <--- Error found
Next

?

Duncan


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 12:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com