see: http://stackoverflow.com/questions/1...sing-excel-vba
Revised to Late Binding approach this becomes:
Function EncodeBase64(text As String) As String
Dim arrData() As Byte
arrData = StrConv(text, vbFromUnicode)
Dim objXML
Dim objNode
Set objXML = CreateObject("MSXML2.DOMDocument")
Set objNode = objXML.createElement("b64")
objNode.DataType = "bin.base64"
objNode.nodeTypedValue = arrData
EncodeBase64 = objNode.text
Set objNode = Nothing
Set objXML = Nothing
End Function
So if your string is in A2 you would use
(obviously remove the = if you wish to embed within another formula - eg ="Apples: "&ENCODEBASE64(A2)&", Pears"
Does that work for you ?
EDIT: to add - the above is a UDF - ie VBA code that should be placed in a stand alone Module - thereafter Macros must be enabled
Bookmarks