バイナリファイルを読んで、テキスト(16進)で書き出す
sample.vbs
'/-------------------------------------
'バイナリファイルを読んで、テキスト(16進)で書き出す
'/-------------------------------------
Private Sub sample_read_binary_file_out_text_file()
Dim filenum As Integer
filenum = FreeFile
Dim filename As String
filename = "sample.zip"
Open ThisWorkbook.Path & "\" & filename For Binary As #filenum
Dim filenum2 As Integer
filenum2 = FreeFile
Dim filename2 As String
filename2 = "filename.txt"
Open ThisWorkbook.Path & "\" & filename2 For Output As #filenum2
Dim value As Variant
Dim i As Integer
i = 1
Do Until EOF(filenum)
value = AscB(InputB(1, #filenum))
'Line Input #filenum, value
If value <> "" Then
'Debug.Print Right("00" & Hex((value)), 2)
Print #filenum2, CStr(Right("00" & hex((value)), 2)); vbTab;
i = i + 1
If i > 16 Then
Print #filenum2, ""
i = 1
End If
End If
Loop
Close #filenum2
Close #filenum
End Sub