在多个用户使用的多个工作簿中使用相同的Excel VB代码,而无需更新每个工作簿

发布于 2025-02-11 19:57:31 字数 620 浏览 1 评论 0原文

TL; DR:有没有一种方法可以让多个(10+)Excel宏工作簿从单个位置运行相同的项目,以便如果我需要修复错误,我不需要在每个工作簿中修复它?

长版本:

我的公司使用Excel工作簿进行工程图表。任何更改的格式都为大胆和突出的灰色。然后,我们在底部有一个修订“表”(我说“表”,因为它只是一些合并的单元格 - 似乎没有一种方法可以制作一个单独的表格,该表不遵循其余部分的列尺寸工作簿,但这是另一天的问题)。

当我们进行新的修订时,我们必须首先清除先前修订版的任何格式,进行更改(并格式化它们),然后将一行插入修订“表”,然后启动“表”,然后启动先前的修订条目并重新格式化我们的新修订版入口。然后,我们将工作簿导出为PDF,我们根据印刷命名格式命名。但是,这样做时很容易犯错误,因为必须根据格式手动输入文件名。

为了使这个过程不那么乏味/容易出错,我编写了一个VB宏程序来自动以上步骤等。它运行良好,并将在我们的图表公司广泛地实施。

但是,我只能自己进行太多的测试 - 一定有我错过或可以更有效地做的事情(我是工程师,而不是专业程序员)。而且我们有数十个工程图表电子表格。如果我们实施此功能,然后我发现我需要修复错误或改进程序的一部分,我不想在每个工作簿中修复它 - 这会花费太长时间,而且太容易了错过一个工作簿!

任何建议将不胜感激。

tl;dr: Is there a way to have multiple (10+) excel Macro workbooks run the same project from a single location so that if I need to fix a bug, I don't need to fix it in every single workbook?

Long version:

My company uses excel workbooks for engineering charts. Any changes are formatted as bold and highlighted gray. We then have a revision "table" at the bottom (I say "table" because it's just some merged cells - there doesn't seem to be a way to make a separate table that doesn't follow the column sizing for the rest of the workbook, but that's a question for another day).

When we do a new revision, we have to first clear any formatting from the previous revision, make our changes (and format them), then insert a row to the revision "table", then unformat the previous revision entry and reformat our new revision entry. Then, we export the workbook as a PDF which we name according to our print naming format. However, it is easy to make mistakes when doing this because the file name must be manually entered according to the format.

To make this process less tedious/error-prone, I wrote a VB macro program to automate the above steps, among other things. It works great, and will be implemented on our charts company wide.

However, I can only do so much testing on my own - there are bound to be things I missed or can do more efficiently (I'm an engineer, not a professional programmer). And we have dozens of engineering chart spreadsheets. If we implement this and then I discover I need to fix a bug or make an improvement to part of the program, I don't want to have to fix it in every single workbook - that would take way too long and be too easy to miss a workbook!

Any advice would be appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文