VBA – Source Control with Git – Video

VBA and source control? Do you know what is VBA? Are you sure we can source control the code, that resides in Excel?

Oh, you mean that lengthy way of extracting the modules one by one? But why? Don’t you have anything better to do with the time you are getting paid?

And actually, why should we do it? Yeah, source control is important, but for big projects, and ours is just an internal app, on which 3 departments count on to take their numbers…

The lines above are combined real life examples, that I have heard when I have mentioned “VBA” and “source control” in one sentence. The main reason for those is that mainly, 99.9% of the VBA developers are not developers, but “financial-controllers”, “analysts”, “secretaries”, “accountants”, “Joe-the-intern”, “logistics consultants”, “tax consultants” and etc. And just that 0.1% of VBA developers that are actually developers are the one that use source control. How I got the data? Took a look at github for VBA code and did not find a lot. Then took a guess 🙂

Anyway, source control is a must. It does not matter whether you are a VBA developer or a senior Python dude. You should use source control. No excuses.

Having said the above, below there is a video, in which I present some automatic code, extracting the VBA code from a project. By running the GitSave() the VBA code is created in 2 nice folders and could be used for source control. The code resides here – https://github.com/Vitosh/VBA_personal/blob/master/VBE/GitSave.vb and looks like this:

To make sure that the above code compiles, you need to add the Microsoft Visual Basic for Extensibility 5.3. reference. This is how to add it (sorry for the German screenshot):

  • In the VBEditor, from the Tools menu, choose References
  • Scroll down to find the Microsoft Visual Basic for Extensibility 5.3.
  • Add it and press “OK”

Thank you!

Tagged with: , ,