如何从另一个模板调用全局模板/插件中的宏函数?
首先,我是一个VBA新手。所以请原谅我的无知。
我有一个全局模板,安装在 Word 启动文件夹中。
全局模板有一些我想访问的宏。但我不知道如何访问宏。
我尝试使用 Application.Run
,但这不起作用(或者至少我做错了)。我不断收到运行时错误 424。
我还尝试使用类似 Call globaltemplatename.modulename.functionname
的方法,但这也不起作用。
我也尝试简单地调用该函数,但随后它说该函数/子未定义。
First, I am a VBA newbie. So please pardon my ignorance.
I have a global template that I installed in the Word startup folder.
The global template has some macros that I would like to access. But I can't figure out how to access the macro.
I tried to use Application.Run
, but that doesn't work (or at least I'm doing it wrong). I keep getting Runtime Error 424.
I also tried to use something like Call globaltemplatename.modulename.functionname
but that doesn't work either.
I also tried to simply call the function but then it says that the function/sub is not defined.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
哈哈...嗯...nvm...我找到了原因...
我没有在我调用的模板中创建引用...
好吧...万一其他人遇到这个问题,您必须打开模板(不是全局模板),然后转到“工具”>“工具”>“模板”。 VB 编辑器中的参考。然后查看全局模板的项目名称。
LOL... um... nvm... I found out why...
I didn't create a reference in the template that I was calling from...
Well...in case anybody else runs into this problem, you have to open the template (not the global template) and then go to Tools > References in the VB editor. And then check the project name of the global template.
整个字符串都用双引号引起来。
Word 不需要模板名称 - 将其保留。
The entire string is in double quotes.
Word does not want the templates name - leave it out.
甚至更多 Word 不允许您使用超过 ModuleName.ProcName 的内容。否则会抛出运行时错误。
Even more Word do not let you use more than ModuleName.ProcName. Otherwise a runtime error will be thrown.