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

Apart from keeping track of changes to Excel workbooks, XLTools add-in also allows VBA version control to track changes to Excel VBA macros. This unique feature is essential for advanced users and Excel VBA developers. It helps compare changes in code, save VBA modules to Git repository or roll back to a previously committed version of macro.

XLTools VBA Version Control add-in keeps your Excel macros safe:

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

 

Add "VBA Version Control" to Excel 2016, 2013, 2010, 2007

Works in: Microsoft Excel 2016 – 2007, desktop Office 365 (both 32 bit and 64 bit).

Download XLTools Add-in

Version Control for Excel ribbon button

 

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 Excel workbook:

Open the workbook > Click the 'Enable' button on 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 folder as your workbook. This is the Git repository that stores all committed versions.

Important: do NOT delete, rename or move this folder. Otherwise all versions history will be lost.

Version Control for VBA macros creates a git repository

 

How to commit a version of VBA module to Change Log

  1. When you have made changes to the script and want to commit the version, first, save the project.
  2. Click 'Commit Changes' on 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 Change Log.

XLTools Version Control Commit Changes to VBA macro

 

How to preview and diff changes to VBA code before commit

  1. Make changes > Click the 'Commit Changes' button. 
  2. Double click on the modified module to diff and preview changes.
  3. The current and the newer versions of VBA script display next to each other. Changes in code are highlighted line by line.
  4. Review the result > 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 open Change Log and compare versions of a macro

  1. Click the 'Change Log' button > A list with all versions displays comments, author and exact time of commit.
  2. Expand/ collapse the list to find the versions of VBA modules want to compare.
  3. Hold 'Ctrl' and select two modules > Click the 'Show changes' button.
  4.  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 Excel macro

  1. Click the 'Change Log' 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 Excel workbooks

Whether or not your Excel workbook contains a macro, you can enable versioning of workbooks and track changes made to worksheets.

 

Any questions or suggestions? Please leave your comment below.

 

Any questions or suggestions? Please leave your comment below.

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

  1. Guido Cinato says:

    Still no roll back improvements in version 5.0, isn’t it?

    • Maria Balobanova says:

      Hi Guido, sorry, not yet. I know it’s been over a year since we first discussed it. In version 5.0 we focused on new features mainly. As to Version Control, we have gathered more feedback and suggestions to act upon. It does take a lot of development effort, and we think Version Control upgrade should deserve a separate release. I do appreciate you following up on the subject! Please bear with us =)

  2. Rajasekaran Rajendran says:

    Hi Team,

    I would like to know is there any possibilities to restore a file using VBA codes?.

    • Maria Balobanova says:

      Hi Rajasekaran, sorry, XLTools does not have a tool to restore a file. You can only restore a previous version of a workbook, if you have activated Version Control and committed versions after making changes to the file.

  3. 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.

  4. 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 *