how to convert xml base64 string gif/jpg/png image file using vba
Posted on 2012-09-12
I am not sure why this is not working?
I am using vba:
If have a base64 gif string (here's the excerpt):
R0lGODlhsAQIB/cAAAAAAI ... <more here> ... u+I1r3rdK1/76te/Ajawgh1jQAAAOw==
I attempted to create a binary file by loading the xml above into a string: base64_string
dim btArr() As Byte
dim base64_string as string
base64_string=<xml from above>
btArr = base64_string
Open 'image.gif" For Binary As #1
Put #1, 1, Base64decode(btArr)
But when I try to see the image by opening the file, it says the image format is invalid.
What else do I need to do to make the file a gif file?