+ Reply to Thread
Results 1 to 3 of 3

Assign a relative macro to a Ribbon Button

  1. #1
    Registered User
    Join Date
    03-31-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2003
    Posts
    1

    Assign a relative macro to a Ribbon Button

    Hi, there.

    I'd like to create a shortcut on the Ribbon and assign to this button the trigger of a macro in the active workbook.

    Seems like customizing the Ribbon only works to assign an macro from a specific Workbook, opening it when clicked.

    So again, I'd like to trigger a macro by its name, on the active workbook. Is it possible? How?


    See ya!
    CaioToOn!

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Assign a relative macro to a Ribbon Button

    CaioToOn!

    As far as I know, putting a macro on the ribbon will only run that assigned macro from the book it was created in (and like you pointed out will open that workbook if the button is pressed from a different workbook). I was able to come up with code that tried to run a different macro within the activeworkbook, but it resulted in this error:

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

    Here's the code I used. Maybe there's a workaround to that error, I'm just not aware of it:

    Please Login or Register  to view this content.


    Hope this helps,
    ~tigeravatar

  3. #3
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Assign a relative macro to a Ribbon Button

    You could put a macro in your personal macro workbook that uses:
    Please Login or Register  to view this content.
    Remember what the dormouse said
    Feed your head

+ Reply to Thread

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