When I was writing/testing the macro, I used a file from my own computer and entered the output to a worksheet I named BEN. The mod below will write the output to what ever the active sheet is. But you must still tell the macro where the binary file is located >> change the BLUE portion of the code below.
Option Explicit
Sub BinToHex()
Dim ColumnNumber As Long, _
RowNumber As Long, _
Ndx As Long, _
InBucket As Variant
Open "c:\downloads\encoding.bin" For Binary As #1
InBucket = Input(LOF(1), #1)
Close #1
RowNumber = 1
ColumnNumber = 0
For Ndx = 1 To Len(InBucket)
ColumnNumber = ColumnNumber + 1
Cells(RowNumber, ColumnNumber) = Hex(Asc(Mid(InBucket, Ndx, 1)))
If (Ndx Mod 16) = 0 Then
RowNumber = RowNumber + 1
ColumnNumber = 0
End If
Next Ndx
End Sub
1. What is the path and name of your file ?
2. Where did you copy the code (did you put it in a worksheet module)?
Bookmarks