How to use version control with VBA code?

I am developing a VBA application which is quite large. I want to use SVN for that application developing.

How can I split my modules from the Excel document and how to upload my modules separately to source control?

  • Java projects within branch treated as separated branch or tags in git from svn?
  • How to ignore config files in SVN?
  • How to synchronize a GIT repository with SVN?
  • How can I commit a single file using SVN over a network?
  • Git or SVN for Rails app?
  • I cannot see the .SVN folders anymore?
  • Please help me.

  • Git: Should I ignore the Index or is there a killer application for it?
  • Create fast-export package from Mercurial repository
  • Publish Git repository to SVN
  • Git Extensions usable with SVN repos?
  • How to delete an old/unused Data Model Version in Xcode
  • Can't Push After git reset --soft HEAD^
  • 4 Solutions collect form web for “How to use version control with VBA code?”

    With file->export file you can export the individual classes.

    That’s one way to split the modules out – temporarily or otherwise.

    Once you’ve done that, you can then create an SVN repository. I won’t go into instructions for that as it’s all over the internet, but here’s a starting point:

    Check out this excel addin .

    It exports all your vba code automatically, as soon as you save your workbook. You can also easily import it again, when you open a workbook. It all work very nicely.

    As a bonus, it comes with a code formatter that you can run within the vba editor, so you can format your code as you write.

    Check out this answer on how to automatically extract all modules/forms/classes to text files. Which will make them more manageable in SVN.

    I wrote a small tool to help with putting VBA code under version control, without requiring anything from Excel, or locking you into any specific version-control system. It can either extract modules from an Office file to a folder, or publish modules from a folder to an Office file. In either case it accesses the Office file directly, not through Excel. It’s available on GitHub:

    Microsoft Office VBA code is usually held in binary format, making proper version control difficult. VBA Sync Tool synchronizes macros between a VBA-enabled file and a folder, enabling easy version control using Git, SVN, Mercurial, or any other VCS.

    To start, select the Extract VBA from Office file option, then select the locations of your repository (or where you’d like to start one) and the Office file. The tool will compare the two locations and show all the differences:

    VBA Sync Tool after selecting folder and file locations

    If you want to extract everything (typical for setting up a repository), just click OK. If you want to be more selective, you can untick specific files (for example some form designs that you know haven’t changed) and then proceed. If you set up a diff tool (under File → Settings), you can double-click on a module to view its changes.

    After a merge, follow the same procedure, but select the Publish VBA to Office file option. When you hit Apply or OK, the tool will write the combined code into the Office file.

    Git Baby is a git and github fan, let's start git clone.