+ Reply to Thread
Results 1 to 2 of 2

Ribbon code... Can someone please explain!

  1. #1
    Forum Contributor
    Join Date
    03-07-2013
    Location
    Montreal
    MS-Off Ver
    Excel 2007
    Posts
    274

    Ribbon code... Can someone please explain!

    Hello,

    I found this particular piece of code on the Internet at

    http://www.rondebruin.nl/win/s2/win012.htm

    but it doesn't work for me and I don't understand it. Here it is:

    Please Login or Register  to view this content.
    Questions

    1) Everytime I run any of the macros (Hide ribbon, DisplayRibbon, DisplayRibbon_1, DisplayRibbon_2 or DisplayRibbon_3) it gets trapped in
    the MsgBox "Error, Save/Restart your workbook" line???? Why?

    2) Who calls this function:

    'Callback for customUI.onLoad
    Sub RibbonOnLoad(ribbon As IRibbonUI)
    Set Rib = ribbon
    End Sub

    3) Who calls this function:

    Sub GetVisible(control As IRibbonControl, ByRef visible)
    If myId = "show" Then
    visible = True
    Else
    If control.Id Like myId Then
    visible = True
    Else
    visible = False
    End If
    End If
    End Sub

    3) What does he mean by this comment:
    'Callback for customUI.onLoad

    Does it mean I have to call this from custom UI editor... if so where in CUI???

    4) Finally, why doesn't the above sample work for me?

    Thanks all for your help
    rn
    Last edited by RustyNail; 05-22-2015 at 11:33 AM.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Ribbon code... Can someone please explain!

    the custom UI editor is just that, an editor for the xml used by ribbonx in excel. You do not run any code in it you only edit the xml text.
    ribbonx uses a callback approach. That means there are a set of events that are related to ribbon and you have to provide the name of the routine in the excel file which you want run when they are trigger by excel.

    So, onLoad is a callback and "RibbonOnLoad" is the routine it will attempt to run. The routine within the excel file stores a reference to the ribbon object for use when the RibbonRefresh routine is executed.

    getVisible is another example of a call back.

    I suggest you read Stephen Bullen's chapter on ribbonx
    http://www.oaltd.co.uk/DLCount/DLCou...ogRef_ch14.pdf
    Cheers
    Andy
    www.andypope.info

+ 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. help explain code for private sub
    By freshfruit in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-03-2015, 03:49 PM
  2. Explain code
    By josros60 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-04-2014, 12:33 AM
  3. Can some one explain this code for me ?
    By chriskingkiller in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-10-2013, 02:14 PM
  4. Can some one explain this code for me ?
    By chriskingkiller in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-10-2013, 12:41 AM
  5. Help Explain this Code
    By khalid79m in forum Excel General
    Replies: 1
    Last Post: 11-27-2008, 06:09 AM

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