+ Reply to Thread
Results 1 to 2 of 2

Excel 2007 : Excel Macros and Ribbon

Hybrid View

DougQval Excel Macros and Ribbon 10-07-2009, 01:12 PM
DougQval Re: Excel Macros and Ribbon 10-08-2009, 02:48 PM
  1. #1
    Registered User
    Join Date
    10-07-2009
    Location
    Houston, TX
    MS-Off Ver
    Excel 2007
    Posts
    6

    Excel Macros and Ribbon

    I'm trying to assign a macro to a button within a customized Ribbon. When the following code is copied into a Module within the active Workbook, the button works fine. However, when the same code is copied to a module within Personal.XLSB, I get the following error message in Excel:

    "Cannot run the macro 'rxbtnTest_Click'. The macro may not be available in this workbook or all macros may be disabled"

    Macro Settings is set to "Enable all macros". Basically, I'd like to use macros saved in Personal.XLSB rather than have to rely on macros saved in the current workbook only.


    Here is the text from the UI Editor:

    <group id="Navigation"
    label="Navigation">
    <button id="rxbtnTest"
    label="Test"
    imageMso="CreateReportFromWizard"
    onAction="rxbtnTest_Click"/>
    </group>


    VBA Code for Macro "Test"

    'Callback for rxbtnTest onAction
    Sub rxbtnTest_Click(control As IRibbonControl)
    With Selection.Interior
    .Pattern = xlSolid
    .PatternColorIndex = xlAutomatic
    .Color = 65535
    .TintAndShade = 0
    .PatternTintAndShade = 0
    End With
    With Selection.Font
    .Color = -16776961
    .TintAndShade = 0
    End With
    Selection.NumberFormat = "$#,##0"
    End Sub

  2. #2
    Registered User
    Join Date
    10-07-2009
    Location
    Houston, TX
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Excel Macros and Ribbon

    Nevermind, I figured it out.

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