can someone help me tweak the below code to convert a file to base64 string. 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.
Here is the code i got. This code converts the text stored in cell A1.
Sub base64()
'this converts the A1 text to base64
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
Thanks! Jack