Link to home
Start Free TrialLog in
Avatar of pmpatane
pmpataneFlag for United States of America

asked on

Getting macros to work in Excel 2010 .xlam Custom Ribbon

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
pmpExcelAddIns.xlsm
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">


  <ribbon>
    <tabs>
      <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>

        <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" />
        </group>

      </tab>
    </tabs>
  </ribbon>

</customUI>

Open in new window

Avatar of FamousMortimer
FamousMortimer
Flag of United States of America image

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

Purely a guess as I found here.

http://rondebruin.nl/win/s2/win001.htm
Avatar of pmpatane

ASKER

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.)
ASKER CERTIFIED SOLUTION
Avatar of pmpatane
pmpatane
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
Did more investigation and found the answer on a web site