The following statements include information from MSDN.
When calling a procedure in VBA, one must make sure that the another module in the project doesn't have a procedure with the same name. If that's the case, you have to specify the module to make sure the right procedure is called, like so.
Sub Main()
Module1.MyProcedure
End Sub
Now, if you work with multiple projects that have procedures with the same name, you have to specify not only the module but also the project - even if the modules have unique names.
Sub Main()
[MyProject.dotm].[MyModule].Main
End Sub
I have the following specific situation. In my normal.dotm, I have a procedure main
in module mod_x
. I created a button in my Quick Access Toolbar to call this procedure directly. It works fine.
In my myTemplate.dotm, there is also a procedure called main
in module mod_y
. So, when I create a document based on this template, I have access to the macros from this template as well as from normal.dotm.
Unfortunately, when pressing the button in the toolbar now, it invariably calls the main-function within mod_y
instead of using the correct main-function from normal.dotm.
Is it possible to change this quick access toolbar button to always call the correct function from normal.dotm and no other?