Bryce Bassett
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
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
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?
What is the macro trying to do?
What objects are involved?
Should, perhaps something be selected before the button is pressed?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Glad you found the solution :-)
ASKER
Discovered solution on my own without assistance from the expert replies.
I'm assuming the button is created using XML, correct?
How many documents are open at the time?
Do you have ribbon refresh code?