Unable to run macros in dotm files on other PCs

故事扮演 提交于 2019-12-25 00:53:20

问题


Macros created and updated to .dotm files work well on the creator's PC, but when distributed to other users they do not work (run).

  1. Tried and double-checked the Trust center settings on MS Word: Macro setting is 'Enable all macros'. Ensured that the location the ("%appdata%\Microsoft\Word\Startup") is already a Trusted Location.

  2. Ensured that all the check points mentioned in this link are as expected.

The code is created following this tutorial:

While the VBA add-in gets recognized, when I click on the add-in button the macro does not run. I suspected that the macro code was getting deleted, since I distributed the .dotm files over email. So, I password protected and zipped them, still the same error.

The error message I am getting is the following:

The macro cannot be found or has been disabled because of your Macro Security settings

I would like to be able to run the macro on other PCs as well.

Update I noticed that the macros, I created were not listed in my PC as well. Now, additionally I did the following change.

Public Sub export_main()
    Call export_helper
End Sub

where,

Public Sub export_helper (ByVal control As IRibbonControl)
 'do stuff
End Sub

With this the macro was getting listed in other PC as well. Since, I did not pass the control value expected for the function export_helper from export_main, the macro threw an error, saying arguments are not supplied. How do I fix this without getting the argument in export_main. Since VBA seems to be expecting a function with no arguments to be listed in the macros window (am not sure if this is right.)

来源:https://stackoverflow.com/questions/56188333/unable-to-run-macros-in-dotm-files-on-other-pcs

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!