Results 1 to 2 of 2

Excel 2007 : Inserting new tab on Ribbon using VBA

Threaded View

  1. #1
    Registered User
    Join Date
    07-22-2009
    Location
    Charlotte, North Carolina
    MS-Off Ver
    Excel 2003
    Posts
    6

    Inserting new tab on Ribbon using VBA

    I was on google searching for a way to insert the 2003 color palette into 2007 when I came across a thread from 2009 where someone showed how to add a tab on the ribbon using VBA that adds the 2003 color palette. I've shown the code below, included the attachment he posted and provided the link to the original thread.

    The problem I have is although the attachment he sent shows the new tab on the ribbon perfectly, it doesn't work on my workbook. I added a module, pasted his code into my new module, saved my workbook, and upon reloading the workbook the new tab on the ribbon does not appear. Does anyone know how to get this tab to appear on a new workbook?

    Thanks.

    Link to prior thread:

    http://www.excelforum.com/excel-2007...el-2003-a.html

    Sub m_ApplyFillColor(CIndex As Long)
        On Error GoTo ErrApplyColorIndex
        
        If TypeOf Selection Is Range Then
            Selection.Interior.ColorIndex = CIndex
        ElseIf TypeOf Selection Is Object  Then
            Selection.ShapeRange.Fill.ForeColor.SchemeColor = CIndex + 7
        End If
        
    ErrApplyColorIndex:
        Exit Sub
        
    End Sub
    
    Public Sub rbxColorIndex_Click(control As IRibbonControl, selectedId As String, selectedIndex As Integer)
    '
    ' Code for onAction callback. Ribbon control gallery
    '
        Dim vntColorIndex As Variant
        
        vntColorIndex = Application.WorksheetFunction.VLookup(selectedIndex, ThisWorkbook.Names("OLD_PALETTE").RefersToRange, 2, False)
        If IsError(vntColorIndex) Then Exit Sub
        
        m_ApplyFillColor CLng(vntColorIndex)
        
    End Sub
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

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.6.0 RC 1