Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default error running macro from Ribbon button

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

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


wrote in message ...
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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Worksheet Functions 1 May 3rd 08 02:35 PM
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Discussion (Misc queries) 1 May 3rd 08 10:52 AM
Running a Macro through a button vs. VBA [email protected] Excel Discussion (Misc queries) 2 August 31st 07 08:00 PM
Running a Macro from a Command Button sammy2x Excel Programming 2 December 30th 05 01:34 PM
Commandbar button running macro Kwan Kim Chuen Excel Programming 0 July 27th 03 11:51 AM


All times are GMT +1. The time now is 10:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"