0

I'm trying to convert a Byte() to a Image so I can display it on a Cell in my WorkSheet, but i couldn't find it anywhere on the internet.

I'm getting the Byte() from a Base64 encoded attribute of a XML. It looks like this:

<ProdutoImagem>
    <Produto>05320</Produto>
    <imagens>
        <ImagemProdutoCor>
            <Cor>20729</Cor>
            <Sequencia>00</Sequencia>
            <Imagem>9j/4AAQSkZJRgABAQEB..... lot of lines here........AAAAAAAKpAMAAQAAAAAAAAAM</Imagem>
        </ImagemProdutoCor>

        <ImagemProdutoCor>
            ...
        </ImagemProdutoCor>
    </imagens>
</ProdutoImagens>

Im trying to get the "Imagem" attribute. Here is the code I've made so far to retrieve it (but haven't tested yet).

Dim Node As IXMLDOMNode
Dim Xml As DOMDocument
Dim Imagem() As Byte


Xml.Load (<confidential link that I can't share>)

For Each Node In Xml.DocumentElement.ChildNodes.Item("imagens")
    If (Node.nodeName = "ImagemProdutoCor") Then
        Node.NodeType = "bin.base64"
        Imagem = Node.nodeTypedValue
        Exit For
    End If
Next

The question: How can I convert Imagem() to a Image attribute, so that I can render it in my WorkSheet later?
I'm using the VBA on Microsoft Office Excel 2007.

VulfCompressor
  • 1,356
  • 1
  • 11
  • 25

0 Answers0