Nick Nick. How does a binary file have "lines"? Add a comment. Active Oldest Votes. Community Bot 1 1 1 silver badge. Erik A Erik A You have to open it using "Binary Access". Curtis Inderwiesche Curtis Inderwiesche 4, 18 18 gold badges 57 57 silver badges 81 81 bronze badges.
LoadFromFile file. Close End With Sorry, I'm not actually sure what library it's in, which is why this sample code uses CreateObject and the literal value 1 instead of the named constant adTypeBinary! This file is in binary format, meaning it shows up as garbage in notepad, excel, etc I can view this file using a hexviewer such as codewright, since it will show you the binary view, but I want to know how to bring this data into excel, and parse it into separate columns in my case, Time, temperature, sensor reading Thanks!
Seti Well-known Member. Joined May 19, Messages 2, Are you sure the data is binary and not hexidecimal? If you only have 2 bytes of data for temp readings, you can only have 4 values 00, 01, 10 and 11 if it is binary. Could you read the file one record at a time and do a conversionin VBA from hex to decimal if indeed it is hex?
What is the file extension, just out of curiosity? Yes, perhaps using the term hexadecimal is more accurate when describing my bytes of information. When I use a hex viewer to look at the data I see the data represented in Hex, for example: 0A BC 02 FE The problem when trying to read this using notepad or excel is that each byte is interpreted as an ascii character, and of course some are valid and others are junk.
So I want the excel file to actually import the values 0A BC 02 FE into columns instead of automatically showing ascii. I suspect I can read the file using a VBA program, but have not done this before, just looking for a few tips on this. You must log in or register to reply here. Similar threads X. Question Excel Template goes oversized importing. Replies 0 Views Nov 18, xendistar. I could explain this further, if you are interested.
It gets a little technical. In some cases, you describe the sequence of NW data as representing multiple sets of 3 data. For example, "6 coordinates stored [ Similarly for the "rigid body displacements" and "rigid body forces" sequences. It is unclear exactly how you want to disambiguate the NW data.
You will need to pay close attention to the order in which those data are stored, and retrieve them accordingly. You will need to pay close attention to this detail. Or I do understand it, and it presents a significant difficulty to implement the input routine in VBA based on my design. The index is "j", not "i".
They are difficult to read in this font, especially when surrounded by parentheses. Not that difficult, really. Just a little less "structured" than I would like. Bottom line: you will need to pay close attention to my procedures readNodes and readFrequencies, as well as readSelectionArrays. I did not implement readLegForces because the description of the data seems to be different from what we see in the formatted file dump. The file dump shows that the corresponding data starting at offset 0b are a sequence of structured data probably in the form: KEY, NW, and NW "real" values type Single.
The KEY seems to be incremented by one for each set of structured data. And each set of structured data is bracketed with the bit integer octet count described in 1 above. If you set noLines to 0 it will read all lines till end of the file. With Binary files often you will be using objects which are not of fixed byte length like Integers. For example you would want to read Strings from binary files together with other data types. In such cases use the Type object data type when writing to a file.
Learn more here. Below a simple example of reading a file to which a Type data type was saved to, including an Integer and String. You can try to read and process XML files similarly as text files shown above.
0コメント