VBA – Reading a Base64 Element into XML and using as Byte Array
Ok, more VBA
Getting a response back as Base64, but when trying to convert it from XML to binary data just having issues.. coming back as ASCII which converts wacked.
What you need to do:
Dim MyInfo As MSXML2.IXMLDOMNodeList
Set MyInfo = xmlDoc.getElementsByTagName(“MyBase64Element”)
MyInfo .Item(0).DataType = “bin.base64″
Dim image() As Byte
image = MyInfo .Item(0).nodeTypedValue
then you can use it in a byte array and convert to an image or whatever datatype you need.
The key here is overriding the type (probably Variant/String by default) to “bin.base64″ and then making sure to use the “nodeTypedValue”
This one threw me for a loop for a little while :)
