+ Reply to Thread
Results 1 to 4 of 4

Macros executed from Ribbons

  1. #1
    Registered User
    Join Date
    07-28-2015
    Location
    Gilbert
    MS-Off Ver
    7
    Posts
    2

    Macros executed from Ribbons

    I've created a macro to load a .bas file inside a Modulex... but when I run the macro a "Call" function doesn't work... the problem is in the next code (ThisWorkbook.VBProject.VBComponents("Module5").CodeModule. _
    AddFromFile (ThisWorkbook.Path & "/DoIt.bas"))...
    If this part of the code is disable .. the macro runs very well... The macro is activated from a button in the ribbon.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: Macros executed from Ribbons

    Did you grant access to VBA project from Trust Center -> Trust Center Settings... -> Macro Settings -> Developer macro Settings -> Trust access to VBA project object model?
    If you are pleased with a member's answer then use the Star icon to rate it.

  3. #3
    Registered User
    Join Date
    07-28-2015
    Location
    Gilbert
    MS-Off Ver
    7
    Posts
    2

    Re: Macros executed from Ribbons

    Hi buran... Yes... Trust access to VBA project object model is enable.... Let's me explain about the file
    My excel file (or macros) are executed through buttons in the ribbon.. I have 6 buttons.. when the file is opened...
    the 6 buttons are disabled... when I enable the first button of the ribbon with a command button,
    and I do a click in the first Ribbon button, the Macro1 is executed and an instruction inside the Macro1
    "call RefreshRibbon = ("Test2") to enable the second button on the Ribbon.... Ribbon button 2 call Ribbon button 3....
    Ribbon button 3 call Ribbon button 4... but Ribbon button 4 doesn't call Ribbon button 5&6.....
    the only way to enable "call"ribbon button 5&6 is to disable (ThisWorkbook.VBProject.VBComponents("Module5").CodeModule. _
    AddFromFile (ThisWorkbook.Path & "/DoIt.bas"))....... inside Module4 (attached file)..................
    Any suggestions ??............... Regards

  4. #4
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: Macros executed from Ribbons

    Unfortunately I have no more ideas.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. how to get the list of macros that can be executed
    By bagullo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-28-2015, 06:22 AM
  2. Resize Toolbar ribbons
    By punter in forum Excel General
    Replies: 0
    Last Post: 08-25-2014, 12:17 PM
  3. [SOLVED] Hide ribbons when Macros are disabled
    By xlman in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-15-2014, 08:42 AM
  4. Hiding ribbons and toolbars
    By lucasar in forum Excel General
    Replies: 2
    Last Post: 02-06-2014, 08:48 AM
  5. Ribbons and Macro Buttons
    By ashleys.nl in forum Excel General
    Replies: 5
    Last Post: 10-01-2011, 02:25 AM
  6. Execute ribbons just in specific workbook
    By The Intern in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-22-2011, 05:31 AM
  7. Replies: 1
    Last Post: 03-10-2010, 09:59 AM

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