Word VBA macro gives "wrong number of arguments or invalid property assigment" error

Programming in VBA for Word 2010.  I've got a toolbar which loads as a global template creating a custom menu ribbon with a bunch of macro buttons.  I've seen this error before when I forget to end my macro with (Control as IRibbonControl), but that's not the issue here.  I can use the macro button when some documents are open, but not others.

As part of this system, I open one template and have a bunch of automations to prepare a first document, then save it.  The button works fine there.  Then I take the resulting first document, open a second different template, transferring content from the first document and then close it.  Now that I am in the second document, that one button no longer works.  It has worked for months until tonight, and the other buttons around it that use the same structure work fine.   I've triple checked spelling in my ribbon code and in the global template and everything lines up.

I know this is a bit cryptic.  I can't share my files because this is a large proprietary project with lots of moving parts required to make it work.   But does anybody recognize the general symptoms and have any suggestions what I should be checking?  

Thanks
Bryce BassettFreelance VBA programmerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DrTribosCommented:
Is it a normal button  (not split button, gallery etc)?
I'm assuming  the button is created using  XML,  correct?
How many documents are open at the time?
Do you have ribbon refresh code?
0
DrTribosCommented:
Can you pinpoint the line of code that fails?
What is the macro trying to do?
What objects are involved?
Should, perhaps something be selected before the button is pressed?
0
Bryce BassettFreelance VBA programmerAuthor Commented:
Thanks for the helpful thoughts.  I am indeed using Ribbon XML to create the menu buttons that invoke the macros, and this command was on a Split Button.

I discovered the problem.  My clue was this only happened with one button and only after opening the second template.  Turns out my second template contains a macro with the exact same name as the macro in the global template I am trying to invoke.  The macro in the document template ends in () rather than (Control as IRibbonControl).  Word thinks the ribbon button is trying to run the () version of the Macro, hence the "wrong number of arguments" error.  I simply renamed one of the macros and the problem went away.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DrTribosCommented:
Glad you found the solution :-)
0
Bryce BassettFreelance VBA programmerAuthor Commented:
Discovered solution on my own without assistance from the expert replies.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Word

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.