Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

How to use git and vba with vba modules?


Asked by Lyra Gaines on Dec 14, 2021 Git



Using Git and GitHub with VBA Code - Briargate Excel - Making Excel Work For You! This post explains how to set up and use Git and GitHub with VBA modules. The code for this post can be found in GitHub. When the code for post VBA Event Handler 2 got very long, I realized that I needed a better way to distribute code.
Additionally,
Therefore, the first step in using Git with VBA is to export the VBA code from within the Microsoft application into a file or files. One file per module. I started with some code from Chip Pearson and modified it for flexibility.
Subsequently, In order to automagically export your workbook’s VBA modules into stand-alone text files on every git commit, you need: Python with oletools installed and the files pre-commit and pre-commit.py in the .git/hooks directory
Also,
With that in place, any git commit automatically takes care of dumping your workbooks VBA content as text files to your filesystem. Which is something that Git understands well. If you are less of a DIY person, I recommend checking out our free, open-source Git extension Git XL.
Accordingly,
VBA Class Modules are allowed a user to create their own object just like how we have built-in objects in regular modules like “Worksheets”, “Workbooks”, “Range”, and so on. Like this using Class Module, we can create custom objects. So in VBA Class Modules are used to create our own objects. The class has a direct relationship with objects.