Function btoa$ (s As String) Const B64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" Dim c1 As _Byte Dim c2 As _Byte Dim c3 As _Byte Dim c4 As _Byte Dim i As Long Dim As String Buffer For i = 1 To Len(s) Step 4 c1 = InStr(B64, Mid$(s, i + 0, 1)) - 1 c2 = InStr(B64, Mid$(s, i + 1, 1)) - 1 c3 = InStr(B64, Mid$(s, i + 2, 1)) - 1 c4 = InStr(B64, Mid$(s, i + 3, 1)) - 1 If c2 > -1 Then Buffer = Buffer + Chr$(((c1 * 4 + c2 \ 16) And 255)) If c3 > -1 Then Buffer = Buffer + Chr$(((c2 * 16 + c3 \ 4) And 255)) If c4 > -1 Then Buffer = Buffer + Chr$(((c3 * 64 + c4) And 255)) Next i btoa$ = Buffer End Function