Track changes and manage history of VBA projects
Apart from keeping track of history of MS Excel sheets, XLTools Version Control also allows tracking changes in 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
Learn how to use Version Control for VBA macros below, or skip to Version Control for Excel sheets.
Add XLTools Version Control to Excel
Works with: Microsoft Excel 2016, 2013, 2010, 2007, Office 365.
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 macro
- How to preview changes to the VBA script before commit
- How to view the history and compare versions of the macro
- How to restore and roll back to a previous version of a macro
- How to use Version Control for 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 a VBA macro
- 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 changes to the VBA script before commit
- Click ‘Commit Changes’ > Double click for diff and preview.
- The current and the newer versions of the 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 the history 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 Excel sheets
Version Control follows the the same logic when tracking changes to Excel sheets. Find details and screenshots here.
Any questions or suggestions? Contact us or leave your comment below.