Excel-VBA 代码的版本控制系统

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/41240745/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-12 11:44:03  来源:igfitidea点击:

Version control system for Excel-VBA code

gitvbasvnversion-control

提问by maniA

I am looking for a version control system which I can use for the Code of VBA possibly in a form of add-inbut similar to SVNor Gitor even a commercial software. I know there is a discussion hereand therehowever, they are older than 6 years and that is not exactly what I want to have. And I know one can use Tortoise SVNjust for the code but not for the whole project (all modules of the code+tables) and I am aware of it that one can do it manually.

我正在寻找一个版本控制系统,我可以将它用于 VBA 代码,可能以插件的形式但类似于SVNGit甚至商业软件。我知道这里那里都有讨论,但是他们已经超过 6 岁了,这并不是我想要的。而且我知道可以将Tortoise SVN用于代码而不是整个项目(代码+表的所有模块),我知道可以手动完成。

回答by ThunderFrame

NOTE: This feature has since been removed.Rubberduck still allows exporting all code files from a VBA project to the file system, but as of 2019/02/08 while it allows importing all code files at once, it will not overwrite existing modules on import, which makes this answer pretty much invalid.

注意:此功能已被删除。Rubberduck 仍然允许将 VBA 项目中的所有代码文件导出到文件系统,但截至 2019/02/08,虽然它允许一次导入所有代码文件,但它不会在导入时覆盖现有模块,这使得这个答案几乎无效.

Disclaimer: I'm a contributor on the Rubberduck VBA project.

免责声明:我是 Rubberduck VBA 项目的贡献者。

The Rubberduck VBA add-in for the VBE, adds a number of features, including Source Control for all VBA hosts. It's actively developed, open source and free, and works in all versions of Excel (and Access, and Word, and PowerPoint, etc) from Excel 2000 onwards, and in 32 and 64-bit versions of Office

用于 VBE 的 Rubberduck VBA 插件添加了许多功能,包括所有 VBA 主机的源代码控制。它是积极开发的、开源和免费的,适用于从 Excel 2000 开始的所有版本的 Excel(以及 Access、Word 和 PowerPoint 等)以及 32 位和 64 位版本的 Office

Rubberduck uses the LibGit2Sharp library, so you can integrate directly with GitHub and other cloud based services, or you can simply export modules and forms to a folder.

Rubberduck 使用 LibGit2Sharp 库,因此您可以直接与 GitHub 和其他基于云的服务集成,或者您可以简单地将模块和表单导出到文件夹。

You can find the project on GitHub here: https://github.com/rubberduck-vba/Rubberduck

你可以在 GitHub 上找到这个项目:https: //github.com/rubberduck-vba/Rubberduck

回答by S Meaden

I don't think there are any compelling source control systems targeting Excel VBA, you'll just have to pick one of the names you already have and adapt it for Excel VBA.

我认为没有任何针对 Excel VBA 的引人注目的源代码控制系统,您只需要选择一个您已经拥有的名称并将其调整为 Excel VBA。

So, I most recently used (and would still choose) GIT but I had/have to export the modules out to a directory. Other Enterprise Level Excel systems I've worked on have similarly export modules and versioned those separately.

所以,我最近使用过(并且仍然会选择)GIT,但我不得不/必须将模块导出到一个目录中。我使用过的其他企业级 Excel 系统也有类似的导出模块并分别对它们进行版本控制。

As for the sheets they typically were housed as a binary file; only on one occasion did I work on a system that stored the sheet logic that lent itself to source control version comparison, it was a custom Xml format.

至于工作表,它们通常作为二进制文件存放;只有一次我在一个系统上工作,该系统存储了用于源代码控制版本比较的工作表逻辑,它是一种自定义 Xml 格式。

Interestingly, the latest Excel file formats format of xlsm and xslx are in fact zip directories of sheet logic atomised. I've looked into this file format and it does not lend itself very well to being version by source control. I think Microsoft missed a trick here.

有趣的是,xlsm 和 xslx 的最新 Excel 文件格式格式实际上是工作表逻辑雾化的 zip 目录。我已经研究过这种文件格式,它不太适合按源代码控制版本。我认为微软在这里错过了一个技巧。