简体   繁体   English

加载宏冲突Excel

[英]Add-in macro conflict Excel

  1. Initially I have 1 function: CusFun in an Add-in1 最初我有1个功能: Add-in1 CusFun
  2. I copy all code in Add-in1 into module in Excel file, save file 1.xlsm 我将Add-in1所有代码复制到Excel文件中的模块中,保存文件1.xlsm
  3. I open 1.xlsm to work, now I have 2 functions CusFun 我打开1.xlsm工作,现在我有2个功能CusFun
  4. I changed the name (and only the name) of the functions in macro in module1 in 1.xlsm as CusFun_Port 我将1.xlsmCusFun_Port宏中的函数的名称(仅名称) 1.xlsmCusFun_Port
  5. Now I have 2 UDF: CusFun and CusFun_Port when I work with 1.xlsm 现在,我有2个UDF: CusFunCusFun_Port当我一起工作1.xlsm

But CusFun_Port (all of them) always return blank while CusFun work normally. 但是,当CusFun正常工作时, CusFun_Port (所有CusFun_Port )始终返回空白。

Why use macro-enabled file instead of add-in? 为什么使用启用宏的文件而不是外接程序? Because I need to send the file to many users back and forth. 因为我需要将文件来回发送给许多用户。 I initially thought only I use them, using add-in save me the trouble of clicking "Enable content" . 最初,我认为只有我才能使用它们,而使用外接程序则可以省去单击"Enable content"的麻烦。 With add-in, every computer use it must install it. 使用外接程序时,每台使用它的计算机都必须安装它。 And when the file is sent to another computer, all the custom functions in the file must be re-targeted to that computer's add-in location. 并且,当文件发送到另一台计算机时,必须将文件中的所有自定义功能重新定位到该计算机的加载位置。 My users are not proficient in any of those tasks. 我的用户不精通任何这些任务。 And those tasks takes far more time than clicking "Enable content" . 与单击"Enable content"相比,这些任务花费更多的时间。

What can I do to make sure that both functions in add-in and file-specific macro work? 我该怎么做才能确保外接程序和特定于文件的宏中的两个功能都能正常工作?

Finally, I found it. 终于,我找到了。 Because I change only the name at the top of the function, it doesn't work. 因为我只更改了函数顶部的名称,所以它不起作用。 Because all of them are recursive, the function's name inside did not change, hence it doesn't work. 因为它们都是递归的,所以函数内部的名称没有更改,因此不起作用。 There is no conflict here. 这里没有冲突。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM