Created
January 24, 2016 13:36
-
-
Save theredstapler/88a612fd1d7510e2dc51 to your computer and use it in GitHub Desktop.
Base64 encoding with VBA
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub Button1_Click() | |
Dim objXML As MSXML2.DOMDocument | |
Dim objNode As MSXML2.IXMLDOMElement | |
Dim arrData() As Byte | |
arrData = StrConv(Cells(1, 1), vbFromUnicode) | |
Set objXML = New MSXML2.DOMDocument | |
Set objNode = objXML.createElement("b64") | |
objNode.DataType = "bin.base64" | |
objNode.nodeTypedValue = arrData | |
MsgBox objNode.Text | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, how do i tweak the same code to convert a file to base64. Say i have a file and file path in cell A1. Cell A1 contains the text ("C:\testing\test1.xls"). I want to base64 test1.xls to string. I want to loop through all the files in column A. Any help is appreciated.
Thanks!
Juan