In the following code, I convert a string and write it to a binary file
Code: Select all
Sub Write_Binary_File()
Dim sFilename As String, s As String, i As Integer, nFileNum As Integer
s = "iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="
sFilename = ThisWorkbook.Path & "\Temp.dat"
nFileNum = FreeFile
Open sFilename For Binary Lock Read Write As #nFileNum
For i = 0 To Len(s)
Put #nFileNum, , Mid(s, i + 1, 1)
Next i
Close #nFileNum
End Sub