grab our rss feed

stevienova.com

Homepage of Steve Novoselac

Entries Tagged ‘VBA’

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.IXMLDOMNodeListSet MyInfo = xmlDoc.getElementsByTagName(”MyBase64Element”)MyInfo .Item(0).DataType = “bin.base64″
Dim image() As Byteimage = MyInfo .Item(0).nodeTypedValue
then you can use it in a byte [...]

Comments (2) | 412 views

MSXML2.IXMLDOMNodeList - Loading XML from files or strings

Again with the VBA, working with MSXML2.IXMLDOMNodeList objects. How do you load XML? Well MSDN shows you how to do it from an XML file..
Loading from an XML File:
Dim MyIXMLDOMNodeListVar As MSXML2.IXMLDOMNodeListDim xmlDoc As New MSXML2.DOMDocument30
xmlDoc.Load “c:\myxml.xml”
If (xmlDoc.parseError.ErrorCode <> 0) Then   Dim myErr   Set myErr = xmlDoc.parseError   MsgBox (”You have error ” & myErr.reason)Else   Set [...]

Leave a Comment | 1,060 views

VBA vs VB.NET - turn bytes into bitmaps

So, recently working on some things, I have noticed the HUGE difference between VBA and VB.NET, specifically with turning bytes into bitmaps.. (assume GiveMeBytes() returns a byte array that is a bitmap)
VB.NET:
Dim image As Byte() = GiveMeBytes()Dim memStream As MemoryStream = New MemoryStream(image)Dim bitImage As Bitmap = New Bitmap(System.Drawing.Image.FromStream(memStream))
bitImage.Save(”C:\test.bmp”)
 
VBA:
Dim image() As Byteimage = GiveMeBytes()
Dim bitImage
bitImage [...]

Leave a Comment | 1,668 views