1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| Public Function Decode_Base64(Text As String) As String
Dim Xml As New MSXML.DOMDocument
Dim Conv As MSXML.IXMLDOMElement
If Text = "" Then
Decode_Base64 = ""
Exit Function
End If
Set Conv = Xml.createElement("Base64")
Conv.dataType = "bin.base64"
Conv.Text = Text
Decode_Base64 = StrConv(Conv.nodeTypedValue, vbUnicode)
End Function
Public Function Encode_Base64(Text As String) As String
Dim Xml As New MSXML.DOMDocument
Dim Conv As MSXML.IXMLDOMElement
Dim Arr() As Byte
If Text = "" Then
Encode_Base64 = ""
Exit Function
End If
Arr = StrConv(Text, vbFromUnicode)
Set Conv = Xml.createElement("Base64")
Conv.dataType = "bin.base64"
Conv.nodeTypedValue = Arr
Encode_Base64 = Conv.Text
End Function |
Partager