Dekodieren mit Base64
27.01.2022 10:55:27
Florian
mit diesen Code kodiere ich Strings mittels Base64.
Private Function EncodeBase64(ByRef arrData() As Byte) As String
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
Private Function DecodeBase64(ByVal strData As String) As Byte()
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.Text = strData
DecodeBase64 = objNode.nodeTypedValue
Set objNode = Nothing
Set objXML = Nothing
End Function
Danach speichere ich die Werte in einer Tabstob-gestrennten TXT Datei. Diese lese ich in Excel über VBA ein und nutze die Entkodierung.Das hat wunderbar funktioniert bis eben. Habe es dann mal mit anderen Strings (länger) getestet und ich erhalte in dieser Zeile beim den Fehler 13 "Typen unverträglich".
DecodeBase64 = objNode.nodeTypedValue
Kann jemand helfen?