CustomUI tab menu item error "Wrong number of arguments or invalid property"

hiici

New Member
Joined
Jul 14, 2017
Messages
14
Hi,

I created the following xml in my .xlam add-in file to load a new tab and menu which works but when I click the Icon, I get the mentioned error . I do not have a separate file open with a same named module which I read can cause this problem. The generate call back and validate identify no issues

Thanks for your help in advance !

HTML:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
 <ribbon startFromScratch="false">
  <tabs>
   <tab id="customTab" label="My Menu">
    <group id="customGroup" label="Header/Filter">
     <button id="customButton" label="Header/Filter" imageMso="HappyFace" size="large" onAction="HeaderFilter" />
    </group>
   </tab>
  </tabs>
 </ribbon>
</customUI>


As a sidenote, The same macro works fine under the Add-In tab using the below code but I would like it to be under my own tab
Code:
    Set cControl = Application.CommandBars("Worksheet Menu Bar").Controls.Add
         With cControl
            .caption = "Header/Filter"
            .DescriptionText = " "
            .HelpFile = "C:.txt"
            .TooltipText = "Toggle Header and Filters On/Off"
            .faceId = 9246
            .Parameter = 2
            .BeginGroup = True
            .Style = msoButtonIconAndCaption
'           .Style = msoButtonCaption
            .OnAction = "HeaderFilter"
         End With
 
Last edited by a moderator:

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
37,103
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
It sounds like you have got the declaration wrong for the HeaderFilter routine. It should take a ribbon control as an argument. (if you used the CustomUI editor, it would create the declaration line for you)
 

hiici

New Member
Joined
Jul 14, 2017
Messages
14
That was it, I didn't think to go back and put the ribboncontrol declaration into the existing module.

thank you Rory!

mike
 

Forum statistics

Threads
1,136,327
Messages
5,675,127
Members
419,551
Latest member
thangxpm

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top