开发者

How do I call a macro function in a global template/add-in from another template?

开发者 https://www.devze.com 2023-02-15 05:20 出处:网络
First, I am a VBA newbie. So please pardon my ignorance. I have a global template that I installed in the Word startup folder.

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开发者_StackOverflow中文版 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.


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.


sTemp = Application.Run ("modulename.functionname")

The entire string is in double quotes.

Word does not want the templates name - leave it out.


Even more Word do not let you use more than ModuleName.ProcName. Otherwise a runtime error will be thrown.

0

精彩评论

暂无评论...
验证码 换一张
取 消