我写了一个宏,我想在不同的Excel文件中使用它,这些文件具有几乎相同的表结构但不同的数据。
那么是否有可能将我的宏脚本“包含”到任何 Excel 文件中?!
我已经读过this tip https://web.archive.org/web/20130926070845/http://office.microsoft.com:80/en-us/project-help/copy-a-macro-HP045304443.aspx但这对我来说听起来像是一个糟糕的笑话。
谢谢
You need to save the document as an Excel Add-in (.xla) and distribute that. Users can then go Tools>Add-ins
to install the add in. They will need to browse to the file you sent them and verify the add-in is checked on the add-in list. Note that add-ins do not show up in Alt+F8 or in Tools>Macro
. You need to make a menu for that in your add-in code. see this post http://spreadsheetpage.com/index.php/tip/creating_custom_menus/ http://spreadsheetpage.com/index.php/tip/creating_custom_menus/
如果您希望您的代码在所有工作簿中可用,请使用您的PERSONAL.XLS
or in Excel 2007-2010 your PERSONAL.XLSB
文件。这些通常保存在XLSTART
您的文档和设置下的文件夹。
这是一个隐藏的工作簿,在您启动 Excel 时打开。
您在此工作簿中复制的代码可在您在 Excel 中打开的所有工作簿中使用。
最简单的制作方法是录制一个虚拟宏,然后在“将宏存储在”下拉列表中选择“个人宏工作簿”。
Open up macro editor (ALT+F9) and then save the PERSONAL.XLS
file. write up a macro, e.g
Public Sub Testing()
MsgBox "Hey im from Personal.xls"
End Sub
请记住隐藏名为personal.xls
(Window>>Hide
)。现在,在任何工作簿上,该宏都可用。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)