AlexanderBB
Well-known Member
- Joined
- Jul 1, 2009
- Messages
- 2,092
- Office Version
- 2019
- 2010
- Platform
- Windows
I have a need to extract text attachments from incoming mail in Thunderbird. It won't do this as a batch operation. I made a VBA routine which takes the Base64 encoded section and passes it to
But about 1 in 10 fail with error -2147024809. "The Parameter is incorrect".
However if I load the pattern into Base64 Decode and Encode - Online it decodes correctly. The pattern is:
NjM0QF4xOTQ2XkBeQmlsbGJvYXJkXkBeU000Nl8wMjBeQF5TTTQ2XzAxOF5AXjIxXkBeOV5A
XjEyXkBeMV5AXjJeQEBeVW5kZXIgVGhlIFdpbGxvdyBUcmVlXkBAXkJpbGx5IFJlaWReQEBA
QEBeXkBAQEBAXk1hY21lbG9kaWVzIEx0ZF5AMiwxMSwxOTQ1IDA6MDA6MDBANCwxLDE5NDYg
MDowMDowMEAyMiwzLDE5NDYgMDowMDowMEBeMTMsMTYsMTUsMTEsNyw1LDUsNSw1LDIsNCwz
LDUsNiw1LDgsMTEsMTIsMTQsMTQsMjBeQF4xNl5AXjE1XkBeMTFeQF43XkBeNV5AXjVeQF41
XkBeNV5AXjJeQF40XkBeM15AXjVeQF42XkBeNV5AXjheQF4xMV5AXjEyXkBeMTReQF4xNF5A
XjIwXkBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBA
QEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBA
QEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBeMTNeQDBAQEBAQF4xM15AQEBeM15AQEBeYSkg
RG9yb3RoeSBTcXVpcmVzICAoUGFybG9waG9uZaBGIDIxMDEpCmIpIEhhcnJ5IFJveSAgKFBh
cmxvcGhvbmWgRiAyMTA3KQpjKSBCaWxseSBDb3R0b24gIChSZXggMTAyMjkpXkBANjM2QDIw
QF5TaGVldE11c2ljXkBeMF5AXjBeQF4wXkBeMF5AMQ0K
Does anyone know what the problem might be ?
VBA Code:
Function DecodeBase64(b64$)
Dim b
With CreateObject("Microsoft.XMLDOM").createElement("b64")
.DataType = "bin.base64": .Text = b64
b = .nodeTypedValue
With CreateObject("ADODB.Stream")
.Open: .Type = 1: .Write b: .Position = 0: .Type = 2: .Charset = "utf-8"
DecodeBase64 = .ReadText
.Close
End With
End With
End Function
However if I load the pattern into Base64 Decode and Encode - Online it decodes correctly. The pattern is:
NjM0QF4xOTQ2XkBeQmlsbGJvYXJkXkBeU000Nl8wMjBeQF5TTTQ2XzAxOF5AXjIxXkBeOV5A
XjEyXkBeMV5AXjJeQEBeVW5kZXIgVGhlIFdpbGxvdyBUcmVlXkBAXkJpbGx5IFJlaWReQEBA
QEBeXkBAQEBAXk1hY21lbG9kaWVzIEx0ZF5AMiwxMSwxOTQ1IDA6MDA6MDBANCwxLDE5NDYg
MDowMDowMEAyMiwzLDE5NDYgMDowMDowMEBeMTMsMTYsMTUsMTEsNyw1LDUsNSw1LDIsNCwz
LDUsNiw1LDgsMTEsMTIsMTQsMTQsMjBeQF4xNl5AXjE1XkBeMTFeQF43XkBeNV5AXjVeQF41
XkBeNV5AXjJeQF40XkBeM15AXjVeQF42XkBeNV5AXjheQF4xMV5AXjEyXkBeMTReQF4xNF5A
XjIwXkBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBA
QEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBA
QEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBeMTNeQDBAQEBAQF4xM15AQEBeM15AQEBeYSkg
RG9yb3RoeSBTcXVpcmVzICAoUGFybG9waG9uZaBGIDIxMDEpCmIpIEhhcnJ5IFJveSAgKFBh
cmxvcGhvbmWgRiAyMTA3KQpjKSBCaWxseSBDb3R0b24gIChSZXggMTAyMjkpXkBANjM2QDIw
QF5TaGVldE11c2ljXkBeMF5AXjBeQF4wXkBeMF5AMQ0K
Does anyone know what the problem might be ?