+ Reply to Thread
Results 1 to 6 of 6

Reading a binary file

  1. #1
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Reading a binary file

    Hoping that somebody can help me out here.

    A client has sent me a binary data file which I need to import into Excel. It has 200 records in, each with 160 fixed length fields, and a total record length of 3,780 bytes.

    I haven't messed around with binary files since my days of programming in BBC BASIC (many years ago), but there should be a way for me to define a complete record and just read them one at time, shouldn't there? A quick Google has turned up lots of examples of people reading binary files a byte at a time, which is a bit impractical for my purposes.

    So, could somebody be kind enough to jog my memory on how reading a binary file is done, please?
    Last edited by Andrew-R; 03-13-2012 at 11:59 AM.

  2. #2
    Forum Contributor
    Join Date
    12-28-2011
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    280

    Re: Reading a binary file

    Hi Andrew

    Perhaps this can get you started:

    Please Login or Register  to view this content.

  3. #3
    Valued Forum Contributor
    Join Date
    05-21-2009
    Location
    Great Britain
    MS-Off Ver
    Excel 2003
    Posts
    550

    Re: Reading a binary file

    Something like this, but define your data type as a 3780 byte structure.
    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Reading a binary file

    Thanks for the help, Firefly.

    Embarrassingly enough I remembered I still had a copy of Qbasic program that I wrote in the mid-90s knocking about, and I ended up ******* off the file read methodology from that...

    Please Login or Register  to view this content.
    I'm sure this is a horribly archaic way of doing this, but it does seem to work.

  5. #5
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Reading a binary file

    Thanks, Chippy - just seen your response.

  6. #6
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Reading a binary file

    or
    Please Login or Register  to view this content.



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1