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
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
- How to commit changes to a VBA modules
- How to preview and diff changes to VBA code before commit
- How to view version log and compare versions of the macro
- How to restore and roll back to a previous version of a macro
- How to use Version Control to track changes in sheets
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…”
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.
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.
How to commit changes to VBA modules
- When you have made changes to the code and want to commit the version, first, save the project.
- Click ‘Commit Changes’ on the XLTools tab > A dialogue box will open.
- 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.
How to preview and diff changes to VBA code before commit
- Click ‘Commit Changes’ > Double click for diff and preview.
- The current and the newer versions of VBA script display side by side. Changes in code are highlighted.
- Click OK to commit this new version, or Cancel to go back to editing.
How to view version log and compare versions of the macro
- Click the ‘Show History’ button > A list with all versions displays comments, author and exact time of commit.
- To compare two versions expand the list > Hold ‘Ctrl’ and select any two modules.
- Click ‘Show Changes’ > The older and the newer versions display side by side, changes in code are highlighted.
How to restore and roll back to a previous version of a macro
- Click the ‘Show History’ button > Double click on the VBA module you want to restore from the history.
- Copy the code from the window > Open the macro for editing > Paste the code to the VBA module.
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.