views:

460

answers:

1

I need to convert an image inside Excel (or through VBA) to base64 (in the end I will make XML output).

How can I do this? Do I need to make a reference to DOM?

I´ve been reading this question but it only works for text strings not images...

Does anyone have any code that I can see?

A: 

Please, take a look here: Base64 Encode & Decode Files

EDIT: Take a look on http://pastebin.com/f2a199d30

Rubens Farias
Thanks a lot Rubens.This solution requires the user to install a external component, (if i understand correctly!) the problem is that the workbook has to be distributable...Do you know of a solution with a commonly used component?
SpeeD72
Are talking about `"Scripting.FileSystemObject"`? Thats a "commonly used component" for sure =)
Rubens Farias
Im talking about the XBase64.dll that the code requires me to install...this is the note inside the code...' This function uses Belus Technology's XBase64 component to Base64 encode a file.' The XBase64 component is available at' http://www.xstandard.com/en/documentation/xbase64/
SpeeD72
Sorry, I missed that; you can go with Microsoft.XMLDOM as described here: http://stackoverflow.com/questions/169907/how-do-i-base64-encode-a-string-efficiently-using-excel-vba
Rubens Farias
Thanks Rubens!I´ll give it a try. Tomorrow will post the results!SpeeD
SpeeD72
Hi.I cant get it to work with MS.XMLDom... I´ve replace on code by the other but no result...'Set objBase64 = CreateObject("XStandard.Base64")Set objBase64 = CreateObject("MSXML2.DOMDocument")Thanks...
SpeeD72
Try `Microsoft.XMLDOM`
Rubens Farias