View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] debbie@thedivorcehelp.com is offline
external usenet poster
 
Posts: 2
Default error running macro from Ribbon button

Hi,

I've developed an application in v. 2007 that utilizes a lengthy
wizard and runs without error when I run it directly from my VBE.
Before I figured out Ribbons, I tried running it from a custom menu
and it worked. Now I've created my custom tab, groups, buttons... on
my ribbon, and it looks the way I want it. But when I try to run my
macro from the custom button on the ribbon I get the following error:
"Wrong number of arguments or invalid property assignment."

I set the "OnAction" in the XML to the name of the subprocedure I want
it to run.

OK, I have tried everything. I've created a sub called
"ExpenseHelp". The only thing in the sub is a msgbox "running
program". I saved and closed it. In the Custom UI Editor I opened
the macro-enabled file. I selected Microsoft's Sample "Custom Tab",
and only changed the button's OnAction to "ExpenseHelp" and button
label to "Expense Help". I verified it, saved it, opened the file in
Excel. I see the custom tab and button. When I select the button, I
get the same error! I've also tried saving it as an add-in, same
thing. Am I somehow calling the macro incorrectly, or have it in the
wrong location, or is there an update to Ribbonx I need?

XML:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/
customui"
<ribbon startFromScratch="false"
<tabs
<tab id="customTab" label="Custom Tab"
<group id="customGroup" label="Custom Group"
<button id="customButton" label="Expense Help"
imageMso="HappyFace" size="large" onAction="ExpenseHelp" /
</group
</tab
</tabs
</ribbon
</customUI

Excel file:
sub ExpenseHelp()
msgbox "running program"
end sub

help... please

Debbie