Base64 is a way of representing binary data using alphanumeric characters only, usually used for transmitting binary over a text channel such as email. There are components available to buy for encoding and decoding Base64, but not many people realise it can be done for free without implementing all the gory details.
Rather that implement Base64 Encoding/Decode in Visual Basic the hard way, it is possible to access this functionality provided by Microsoft's XML functions.
This example refers to Visual Basic 6, to do this in VB.Net, check out VB.Net Base64 Encoding in One Line of Code
In VB6, add a project reference to Microsoft XML, v2.6 (or later)
The following fuctions wrapper the encoding/decoding functionality:
To test the above functions, the following code decodes encoded data, its output should match the input. The StrConv function is used to convert strings into byte arrays and vice versa.
Hope this helps.
Public Sub Main()
Dim strData As String
strData = EncodeBase64(StrConv("Greetings and Salutations", vbFromUnicode))
Debug.Print StrConv(DecodeBase64(strData), vbUnicode)
Greetings and Salutations