How to use version control with VBA code?

前端 未结 4 803
故里飘歌
故里飘歌 2020-12-13 09:59

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 ho

4条回答
  •  误落风尘
    2020-12-13 10:34

    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:

    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.

提交回复
热议问题