从外接程序运行宏 [英] running a macro from an add-in
问题描述
我有一个名为book1的加载项.在插件中有一个名为module1的模块,该模块有一个名为addin1的子
i have an add-in called book1. inside the addin there is a module called module1 which has a sub called addin1
我想从其他工作簿中运行宏addin1
i would like to run the macro addin1 from a different workbook
我正试图像这样调用此宏:
i am trying to call this macro like this:
Call Addin1
但这不起作用
我尝试过:
Call book1.xlam.Module1.AddIn1
这也不起作用
有人知道如何运行外接程序中的宏吗?
does anyone know how to run a macro that is within an add-in ?
推荐答案
(假设Office 2007) 这是一个示例:
(Assuming Office 2007) Here's an example:
1-打开一个新的工作簿.
2-添加包含代码MsgBox("Add-In")
的宏
3-另存为xlam文件.
4-打开新的工作簿.
5-单击Office按钮-> Excel选项
6-单击左侧的加载项"选项卡.
7-在底部的管理"下拉菜单旁边,选择"Excel加载项",然后单击执行".
8-单击浏览,然后导航到您的xlam文件.
9-确保选中文件旁边的框,然后单击确定".
10-单击Office按钮-> Excel选项.
11-单击自定义"选项卡.
12-在从下拉列表中选择命令"中选择宏.
13-双击您的插件,现在在快速访问工具栏上将出现一个按钮.
14-单击按钮,您的消息框将立即显示.
1- Open a new Workbook.
2- Add a macro that contains the code MsgBox("Add-In")
3- Save as xlam file.
4- Open new Workbook.
5- Click Office Button -> Excel Options
6- Click the Add-Ins tab on the left.
7- At the bottom, next to the "Manage" dropdown, select "Excel Add-Ins" and click Go.
8- Click Browse and navigate to your xlam file.
9- Ensure the box next to your file is checked and click Ok.
10- Click the Office Button -> Excel Options.
11- Click Customize Tab.
12- Select Macros in the "Choose Commands From Dropdown."
13- Double click your AddIn and now a button will appear on the Quick Access Toolbar.
14- Click the button and your message box will now show.
这篇关于从外接程序运行宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!