Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

reading binary data from a file 1

Status
Not open for further replies.

Bong

Programmer
Dec 22, 1999
2,063
US
Greeting.

I want to input data from a binary file and display those data in Excel as HEX strings.

Putting aside the HEX string for now, I tried just getting each byte of binary data but it didn't work like I was hoping.

First I tried:
Code:
open tstdat3.bin for binary as #1
cells(1,1)=input(1,#1)
but that put the byte as a character in the cell, as one would expect.

I tried:
Code:
open tstdat3.bin for binary as #1
cells(1,1)=cint(input(1,#1))

but that threw a type mismatch error.

I looked in the thread archive and found something that looked like it should work for me, using
open <filename> for random as #1 len=1
and get #1, 1, bytevar, but that gave me an error because of automation unsupported

I'm pretty new to VBA so I'm sure there's something simple I need to know but I'm not finding it.

Any ideas?

_________________
Bob Rashkin
 
And what about this ?
open tstdat3.bin for binary as #1
cells(1,1)=hex(asc(input(1,#1)))

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks.
That's just what I needed.

_________________
Bob Rashkin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top