error running macro from Ribbon button

D

debbie

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
 
R

Ron de Bruin

Hi debbie

When you are in the UI editor click on the generate callbacks button.

Looks like this then

Sub ExpenseHelp(control as IRibbonControl)
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top