VBA Version Control add-in: track revision history of Excel macros and compare changes to VBA code

Apart from keeping track of changes to MS Excel sheets, XLTools also allows VBA version control (tracking changes to Excel VBA macros). This unique feature is essential for VBA developers to compare changes in code, export VBA modules to Git repository or roll back to a previously committed version of macro.

XLTools Version Control keeps Excel macro data safe:

  • Commit versions of VBA project modules and track changes
  • Compare versions and highlight changes in code line by line
  • Store versions in a Git repository on your own PC
  • Keep version log and track who changed what and when
  • Recover any previous version of the script

XLTools Version Control for VBA macros functionality overview


Add VBA Version Control in Excel 2016, 2013, 2010, 2007

Works in: Microsoft Excel 2016 – 2007, desktop Office 365. Both 32 bit and 64 bit versions.

Download XLTools Add-in


Learn your way around:


How to enable Version Control for VBA macros in Excel

1. Enable Developer macro settings:

Developer tab > Macro Security > Check “Trust access to the VBA project object model”.
Or, File > Options > Trust Center > Trust Center Settings > Macro Settings > Check “Trust access…”

XLTools Version Control Macro Settings

2. Enable Version Control for the workbook:

Open the workbook > Click the ‘Enable’ button on the XLTools ribbon.
Or, open XLTools Settings > Version Control tab > Enable.

Enable XLTools Version Control for VBA modules

3. Immediately a new folder ‘WorkbookName_Revisions’ will automatically appear at the same destination as your workbook.

Important: do not delete the folder. This is the Git repository that holds all committed versions.

Version Control for VBA macros creates a git repository


How to commit changes to VBA modules

  1. When you have made changes to the code and want to commit the version, first, save the project.
  2. Click ‘Commit Changes’ on the XLTools tab > A dialogue box will open.
  3. Add a descriptive comment to tell the versions apart > OK.

Note: the version is committed only via the ‘Commit Changes’ button. If you simply save the VBA project, the version is not committed to history.

XLTools Version Control Commit Changes to VBA macro


How to preview and diff changes to VBA code before commit

  1. Click ‘Commit Changes’ > Double click for diff and preview.
  2. The current and the newer versions of VBA script display side by side. Changes in code are highlighted.
  3. Click OK to commit this new version, or Cancel to go back to editing.

XLTools VBA Version Control: preview, diff and commit changes to code


How to view version log and compare versions of the macro

  1. Click the ‘Show History’ button > A list with all versions displays comments, author and exact time of commit.
  2. To compare two versions expand the list > Hold ‘Ctrl’ and select any two modules.
  3. Click ‘Show Changes’ > The older and the newer versions display side by side, changes in code are highlighted.

XLTools Select VBA module versions to compare

XLTools Compare VBA modules side by side


How to restore and roll back to a previous version of a macro

  1. Click the ‘Show History’ button > Double click on the VBA module you want to restore from the history.
  2. Copy the code from the window > Open the macro for editing > Paste the code to the VBA module.

XLTools Recover and Roll Back To a Previous Version of a the VBA macro


How to use Version Control to track changes in sheets

Whether or not your workbook contains a macro, you can still enable versioning of worksheets to track any other changes to a spreadsheet.

 

Any questions or suggestions? Please leave your comment below.

 

4 Responses to VBA Version Control add-in: track revision history of Excel macros and compare changes to VBA code

  1. Guido Cinato says:

    Hi Maria, it seems to me that you still don’t have implemented new roll back procedures.
    Does versioning work also with excel files with old .xls format?

    • Maria Balobanova says:

      Hello Guido,
      Not yet, indeed. It is in our development schedule, though.
      And yes, Version Control also works for files in .xls format.

  2. Guido Cinato says:

    very interesting, but I find the roll back procedure should have better and easier method

Leave a Reply

Your email address will not be published. Required fields are marked *