Link to home
Start Free TrialLog in
Avatar of Bryce Bassett
Bryce BassettFlag for United States of America

asked on

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
Avatar of DrTribos
DrTribos
Flag of Australia image

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?
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?
ASKER CERTIFIED SOLUTION
Avatar of Bryce Bassett
Bryce Bassett
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Glad you found the solution :-)
Avatar of Bryce Bassett

ASKER

Discovered solution on my own without assistance from the expert replies.