Some time ago I had to open a VBA file saved as *.xlsb. The password protection for this was a little more difficult than the one for *.xlsm, thus after some research I have found a tool called VbaDiff, which claimed that it can manage it with one click of a button. And it promised even more – comparison of VBA code like a real source control program. This was enough for me to ask Chris Spicer, the developer of the VbaDiff to kindly provide me with a professional copy for a review. This is what he wrote me about the inspiration for creating the tool:
VbaDiff came about from my VBA programming experience. I found it frustrating to not be able to compare code from one version to another. VbaDiff was one of my first C# projects and a great learning experience.
So, less than a week after I was granted with the software, I am sitting behind my PC and writing it 🙂
The install of VbaDiff was rather easy – downloading the Trial version from the site, clicking a few time next>next and then entering the code for the professional licence at the licence window. This is how the result looks like:
As soon as I have installed it, I have created two files (Test1.xlsb and Test2.xlsb) with some similar VBA code in them, in order to check the way the source control system works. As you see in the screenshot below, it found immediately, that in the “mod_functions” the code is not the same in the two files and the “mod_added” is not present in “Test1.xlsb”.
Then the challenge came – I had to select a Diff Tool from the list of the DiffTools. As far as I am always using GitHub and Git for source control, I have decided to choose the TortoiseSvn, as far as I was using TortoiseGit before 🙂 I installed it through the link and actually nothing happened… When I was thinking what is happening, I have simply decided to close the program and to open it again and then – voila – TortoiseSvn was recognized as an installed DiffTool. Not bad!
Thus, I have selected the “mod_functions” and it opened through Tortoise, showing me kindly the two files with their differences like this. Looks great and useful – the first time I see a VBA a source control system, that actually works with VBA file!
We can go even one step further – we may change the files in the Tortoise (Or whatever diff tool you select from the list) and to write them back to the VBA file. In this case, you may see the small asterisk, at the end of the module, that is going to be changed – in this case “mod_functions*”. After clicking the “save” button changes are saved.
Last but not least – I have checked the initial reason for finding this software – it claimed that it may open any VBA code in xlsb or xlsm format. I tried it with my files and the result is visible on the screenshots below:
Just one click was needed to remove the password (actually I was already expecting it, as far as it had already showed the modules and their code in the password protected worksheets).
The last useful feature of VbaDiff, that I would note down is the automatic export option of VBA to a disk. Really useful, if you want to share your progress with another developer in a team, without sending the Worksheet. Thus you may use GitHub or other source control, exporting to a git-shared folder.
At the end – I did read the manual just at the end – the tool had a really simple interface, thus it is really easy to work with. 🙂
Pretty much that is all – with tools like this, the VBA developers are enabled to work more professionally, taking best practices from the other programming languages. Quite a good first C# project, Chris! 🙂