Had another project where I had to encode text as Base64 (in my case, it was to limit the character set used in the result).

If you are adding this to a VBA project, place it in a module and add a reference to Microsoft XML 3.0.

Function EncodeBase64(text as String) as String
    Dim arrData() as Byte
    arrData = StrConv(text, vbFromUnicode)
    Dim objXML as MSXML2.DOMDocument
    Dim objNode as MSXML2.IXMLDOMElement
    Set objXML = New 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