+ Reply to Thread
Results 1 to 7 of 7

Thread: Adding buttons to custom tab

  1. #1
    Registered User
    Join Date
    01-12-2012
    Location
    UK
    MS-Off Ver
    Excel 2007/10
    Posts
    4

    Adding buttons to custom tab

    Hi

    I have an add-in that creates a custom tab on the ribbon. A few of the buttons load other add-ins, I would like for these to be able to add buttons to my custom tab, however all attempts to do this result in either i) a new tab on the ribbon or ii) nothing. Any ideas?

    Cheers

    Mat
    Last edited by mat.davies; 01-13-2012 at 05:30 AM. Reason: solved

  2. #2
    Forum Guru pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2010
    Posts
    5,155

    Re: Adding buttons to custom tab

    Hi Mat.davies
    welcome to the forum!
    Do you mean the ribbon?
    Andy has a good ribbon designer here
    http://www.andypope.info/vba/ribboneditor.htm
    What is the code?
    regards pike

    If the solution helped please donate
    here to the RSPCA

    Sites worth visiting;

    J&R Solutions - royUK

    AJP Excel Information - Andy Pope

    Spreadsheet Toolbox

    VBA for smarties - snb

  3. #3
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    2003 & 2007 & 2010
    Posts
    11,351

    Re: Adding buttons to custom tab

    If you want to share a custom tab you need to use the Namespace and idQ referencing.
    Cheers
    Andy
    www.andypope.info

  4. #4
    Registered User
    Join Date
    01-12-2012
    Location
    UK
    MS-Off Ver
    Excel 2007/10
    Posts
    4

    Re: Adding buttons to custom tab

    Hi Pike, thanks for the quick reply.

    Yes, I was referring to the ribbon. The editor you sent looks interesting, but I dont have admin access to the PC to install it, and I'm not sure it can do what i'm after.

    I've tried quite a bit of code, in the 1st workbook, customui.xml, i have

    <?xml version="1.0" encoding="utf-8" ?> 
    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"> 
    <ribbon> 
        <tabs> 
            <tab id="myTab" label="Stuff" keytip="U"> 
                <group id="group" label="group"> 
    	    <button 
                         id="stuff1" 
                         label="dostuff" 
                         imageMso="FileCheckIn" 
                         size="large"
                         onAction="dostuff" 
                    />
                </group>
            </tab> 
        </tabs> 
    </ribbon> 
    </customUI>
    The macro 'dostuff' then loads a second file, it's the xml in this file that i'm not sure of. I've tried variations around the following

    <?xml version="1.0" encoding="utf-8" ?> 
    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"> 
    <ribbon> 
        <tabs> 
            <tab id="myTab"> 
                <group id="group"> 
    	    <button 
                         id="stuff2" 
                         label="domorestuff" 
                         imageMso="FileCheckIn" 
                         size="large"
                         onAction="domorestuff" 
                    />
                </group>
            </tab> 
        </tabs> 
    </ribbon> 
    </customUI>
    where the macro 'domorestuff' is in the second addin. This doesn't work. I have tried playing around with the <tab> and <group> tags, and tried calling the name as a tabMSO, which doesn't work.

    Thanks again,

    Mat

  5. #5
    Registered User
    Join Date
    01-12-2012
    Location
    UK
    MS-Off Ver
    Excel 2007/10
    Posts
    4

    Re: Adding buttons to custom tab

    Cheers andy, I've figured out what is needed, will post the correct code once I've got it working!

    Mat

  6. #6
    Registered User
    Join Date
    01-12-2012
    Location
    UK
    MS-Off Ver
    Excel 2007/10
    Posts
    4

    Re: Adding buttons to custom tab

    Working xml for customui.xml in both files...

    <?xml version="1.0" encoding="utf-8" ?> 
    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" xmlns:nsMat="MatNamespace"> 
    <ribbon> 
        <tabs> 
            <tab id="nsMat:myTab" label="Stuff" keytip="U"> 
                <group id="group" label="group"> 
    	    <button 
                         id="stuff1" 
                         label="dostuff" 
                         imageMso="FileCheckIn" 
                         size="large"
                         onAction="dostuff" 
                    />
                </group>
            </tab> 
        </tabs> 
    </ribbon> 
    </customUI>
    <?xml version="1.0" encoding="utf-8" ?> 
    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" xmlns:nsMat="MatNamespace> 
    <ribbon> 
        <tabs id="nsMat:myTab" label="Stuff" keytip="U"> 
            <tab id="myTab"> 
                <group id="group2" label="group"> 
    	    <button 
                         id="stuff2" 
                         label="domorestuff" 
                         imageMso="FileCheckIn" 
                         size="large"
                         onAction="domorestuff" 
                    />
                </group>
            </tab> 
        </tabs> 
    </ribbon> 
    </customUI>
    Code shown adds a new group, but I imagine it's fairly straightforward to add buttons to an existing group, (although I haven't tried)

    Thanks again to everyone who replied!

    Mat

  7. #7
    Forum Guru pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2010
    Posts
    5,155

    Re: Adding buttons to custom tab

    good stuff its not to hard once you get the hang of it
    regards pike

    If the solution helped please donate
    here to the RSPCA

    Sites worth visiting;

    J&R Solutions - royUK

    AJP Excel Information - Andy Pope

    Spreadsheet Toolbox

    VBA for smarties - snb

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0