0

I am using the VBA code below to decode base64 to XML. It works, but only for small size base64 strings. How can I improve it for long strings ?

Function f_textBase64Decode(strBase64)
    Dim b
    With CreateObject("Microsoft.XMLDOM").createElement("b64")
        .DataType = "bin.base64": .Text = strBase64
        b = .nodeTypedValue
        With CreateObject("ADODB.Stream")
            .Open: .Type = 1: .Write b: .Position = 0: .Type = 2: .Charset = "utf-8"
            f_textBase64Decode = .ReadText
            .Close
        End With
    End With
End Function
ZygD
  • 22,092
  • 39
  • 79
  • 102
Shlomo
  • 21
  • 5

0 Answers0