vba 独立 Excel 宏

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11251156/
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-11 16:40:44  来源:igfitidea点击:

Stand Alone Excel Macro

excelexcel-vbavba

提问by cquadrini

I have a report that I run from a system once a week, and the data is exported into an excel document. I have set up the tool that exports the data to excel to do a decent job on formatting, but there is still more that I need to do once the data is in excel.

我有一个报告,我每周从系统运行一次,并将数据导出到 Excel 文档中。我已经设置了将数据导出到 excel 的工具,以便在格式化方面做得很好,但是一旦数据在 excel 中,我还需要做更多的工作。

Is it possible to create a stand alone macro, save it in a Microsoft office folder and be able to call it after I open this file? I have written plenty of macros that are part of ONE given spreadsheet, but never tried one that was open to many spreadsheets.

是否可以创建一个独立的宏,将其保存在 Microsoft office 文件夹中,并在打开此文件后能够调用它?我编写了大量宏,这些宏是 ONE 给定电子表格的一部分,但从未尝试过对许多电子表格开放的宏。

IS it possible, and a starting direction of good resources of where I can learn how to achieve this goal? Thank you.

是否有可能,以及我可以学习如何实现这一目标的良好资源的起始方向?谢谢你。

回答by Siddharth Rout

...and be able to call it after I open this file?...

...并在我打开此文件后能够调用它吗?...

You have 2 very good options

您有 2 个非常好的选择

1)Write and save your macro to Personal file. See this link for more information

1)编写宏并将其保存到个人文件中。查看此链接了解更多信息

Topic: Deploy your Excel macros from a central file

主题:从中央文件部署 Excel 宏

Link: http://office.microsoft.com/en-us/excel-help/deploy-your-excel-macros-from-a-central-file-HA001087296.aspx

链接http: //office.microsoft.com/en-us/excel-help/deploy-your-excel-macros-from-a-central-file-HA001087296.aspx

Quote from the above link:

引用上面的链接

Have you ever wanted to use that really handy macro in all of your Excel worksheets? You can. This column explains how to place your macros in a file called personal.xls and make them available each time you start Excel.

您是否曾经想在所有 Excel 工作表中使用这个非常方便的宏?你可以。此列说明如何将宏放置在名为personal.xls 的文件中,并在每次启动Excel 时使它们可用。

2)Create an Add-In

2)创建加载项

Topic: Creating an Excel Add-in

主题:创建 Excel 加载项

Link: http://msdn.microsoft.com/en-us/library/aa140936%28v=office.10%29.aspx

链接http: //msdn.microsoft.com/en-us/library/aa140936%28v=office.10%29.aspx

Quote from the above link:

引用上面的链接

You create a Microsoft? Excel add-in by creating a workbook, adding code and custom toolbars and menu items to it, and saving it as an Excel add-in file.

你创建了一个微软?Excel 加载项通过创建工作簿、向其中添加代码和自定义工具栏和菜单项,并将其保存为 Excel 加载项文件。