Did someone hand you a large amount of data in an Excel spreadsheet encoded in base64? Or do you have data in an Excel sheet that you need converted to base64? No problem!
Side note: This page has another way to do it with a project reference to a Microsoft XML library. However, we're going to do it our own way, so you can see the entire code.
We're going to use a vb module written by Christian d'Heureuse. It's available here (go ahead and download Base64Coder.bas - it's licensed under the GNU/LGPL license). Open Excel, then record a macro. Then view and edit that macro. A Microsoft Visual Basic editor should open. On the left side is a folder of Modules. Right click on the folder, and import the Base64Coder.bas file you downloaded from Christian's website. Go ahead and read through it if you like.
Now in your own module (the one containing your recorded macro), put these two macros:
Sub DecodeBase64() For Each cell In Selection cell.Value = Base64DecodeString(cell.Value) Next End Sub
Sub EncodeBase64() For Each cell In Selection cell.Value = Base64EncodeString(cell.Value) Next End Sub
Save, and go back to your Excel sheet. Now you can select the cells you'd like to convert, and run the "DecodeBase64" and "EncodeBase64" macros as needed. If you don't want to go through all the setup process, here's an Excel spreadsheet already set up for you. Enjoy!