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).
Learn your way around:
- How to enable Version Control for VBA macros in Excel
- How to commit a version of VBA module to Change Log
- How to preview and diff changes to VBA code before commit
- How to open Change Log and compare versions of a macro
- How to restore and roll back to a previous version of Excel macro
- How to use Version Control to track changes in Excel workbooks
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 Excel workbook:
Open the workbook > Click the 'Enable' button on XLTools ribbon.
Or: open XLTools Settings > Version Control tab > Enable.
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.
How to commit a version of VBA module to Change Log
- When you have made changes to the script and want to commit the version, first, save the project.
- Click 'Commit Changes' on 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 Change Log.
How to preview and diff changes to VBA code before commit
- Make changes > Click the 'Commit Changes' button.
- Double click on the modified module to diff and preview changes.
- The current and the newer versions of VBA script display next to each other. Changes in code are highlighted line by line.
- Review the result > Click OK to commit this new version, or Cancel to go back to editing.
How to open Change Log and compare versions of a macro
- Click the 'Change Log' button > A list with all versions displays comments, author and exact time of commit.
- Expand/ collapse the list to find the versions of VBA modules want to compare.
- Hold 'Ctrl' and select two modules > Click the 'Show changes' button.
- 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 Excel macro
- Click the 'Change Log' 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 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.