Getting macros to work in Excel 2010 .xlam Custom Ribbon

Posted on 2013-09-13
Medium Priority
Last Modified: 2013-09-19
I have created an .xlsm file that I want to save as .xlam after I have it working properly.  I have simple macros in there that work just fine when run from the macro window (ALT+F8) or directly from the VBA Editor.  I added .xml code to create a custom ribbon with buttons to run the macros.  The ribbons and buttons show up fine, but I always get an error, "Wrong number of arguments or invalid property assignment."  I can immediately run the macros manually and they work just fine, so I guess there is something wrong with either the xml (I am quite the novice here on xml)  or there is a reference problem.  Any ideas?

Below is the xml I used for creating the custom ribbon/buttons and the xlsm file is attached
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">

      <tab id="MyCustomTab" label="Case and Selections" insertAfterMso="TabHome">
  	  <group id="customGroup1" label="Adjust Case">
          <button id="customButton1" label="Lower" size="large" onAction="LowerCaseMacros" imageMso="LowerCase" />		
          <button id="customButton2" label="Upper" size="large" onAction="UpperCaseMacros" imageMso="UpperCase" />
          <button id="customButton3" label="Proper" size="large" onAction="ProperCaseMacros" imageMso="ProperCase" />
          <button id="customButton4" label="Sentence" size="large" onAction="SentenceCaseMacros" imageMso="SentenceCase" />

        <group id="customGroup2" label="Decrease Selection">
          <button id="customButton5" label="Unselect current cell" size="large" onAction="UnSelectActiveCells" imageMso="SelectionPane" />
          <button id="customButton6" label="Unselect current area" size="large" onAction="UnSelectCurrentAreas" imageMso="_3DEffectsOnOffClassic" />



Open in new window

Question by:pmpatane
  • 4
LVL 10

Expert Comment

ID: 39491489
I think the problem may be in the <group id>.  you might need to specify insertAfterMso=...

Purely a guess as I found here.


Author Comment

ID: 39491546
Hi FamousMortimer,
The group id with the insertAfterMso= was because it was on an existing tab (the home tab) and it was code for where the group should go.  Thanks for checking, though!  (I did try it anyway and it made my Tab not appear at all.)

Accepted Solution

pmpatane earned 0 total points
ID: 39491740
Found the answer!  I had Sub ProperCaseMacros() for macro name, s/b
Sub ProperCaseMacro(control As IRibbonControl)

Author Comment

ID: 39493010
I don't think I should gt the points, since I answered my own question, but the answer works and the question should be closed

Author Closing Comment

ID: 39505185
Did more investigation and found the answer on a web site

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question