Sir Waxalot
04-04-2003, 07:34 AM
I want to open a binary .dat data file in Excel. I know you can open a .dat text file, but I don't know how to open a binary file in Excel. I know how to convert a binary .dat data file to a comma separated variable (CSV) using matlab, but I want to use visual basic and open it in excel. I'm trying to eliminate the need for the converting step in matlab. Has anyone done this or can you point in the right direction.
Legend
04-06-2003, 09:40 PM
Public bytFileArray() As Byte
Sub OpenFile(strfileName As String)
Dim lngFileNumber As Long
lngFileNumber = FreeFile
Dim lngFileLength As Long
lngFileLength = FileLen(strfileName)
ReDim bytFileArray(lngFileLength) As Byte
Open strfileName For Binary As lngFileNumber
Get lngFileNumber, , bytFileArray
Close lngFileNumber
End Sub
If you know that the file is a text file, then you can read it into an appropriately dimensioned string instead. :)