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?

  • SVN automatic code formatting on check in?
  • Retroactive svn import into git
  • How to configure SVN web access for different write permissions?
  • Starteam to SVN migration, alternatives to Polarion?
  • How to best update a website from subversion
  • Where do you put your app-config-files when deploying rails with capistrano and svn
  • Please help me.

  • when updating a whole project's root, how to exclude svn externals from being updated?
  • Converting from no version control
  • How can KDiff3 be used properly with TortoiseSVN to resolve conflicts?
  • Best strategy to write hooks for subversion in Windows
  • Subclipse: how to keep a branch in sync?
  • Subversion commit failed Merge of file: 200 OK
  • 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:

    http://svnbook.red-bean.com/en/1.0/ch05s02.html

    Check out this excel addin https://github.com/hilkoc/vbaDeveloper .

    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.