+ Reply to Thread
Results 1 to 5 of 5

A Ribbon control event can call another ribbon control event ?

  1. #1
    Registered User
    Join Date
    02-21-2018
    Location
    Paris
    MS-Off Ver
    2010
    Posts
    2

    A Ribbon control event can call another ribbon control event ?

    HI,


    I have added couple controls on ribbon bar of excel,
    1. A button control
    2. A drop down list

    On Button click can I change the value in Drop down list ?

    Thanks for your reply....

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

    Re: A Ribbon control event can call another ribbon control event ?

    Had to use quotes as Sucuri was blocking reply.

    You would need to use the "onLoad" routine to store a reference to the ribbon interface

    You can then use the Invalidate method which would trigger a callback associated with the dropdown.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    02-21-2018
    Location
    Paris
    MS-Off Ver
    2010
    Posts
    2

    Re: A Ribbon control event can call another ribbon control event ?

    Thanks for rep...
    I have created something like this ...

    'Callback for customUI.onLoad
    Dim MyRibbonExcel As IRibbonUI

    'Callback for customUI.onLoad
    Sub onLoadRibbon(ribbon As IRibbonUI)
    Set MyRibbonExcel = ribbon
    End Sub

    'Callback for Button1 onAction
    Sub onActionButton(control As IRibbonControl)
    Module1.MyRibbonExcel.InvalidateControl ("dropDownID")
    End Sub

    'Callback for dropDownID getSelectedItemIndex
    Sub getSelectedItemIndex_dropDown(control As IRibbonControl, ByRef returnedVal)
    returnedVal = 2
    End Sub

    'Callback for dropDownID onAction
    Sub OnActionDropDown(control As IRibbonControl, id As String, index As Integer)
    End Sub


    When ever I click the button it is calling "getSelectedItemIndex_dropDown" method and value of drop is changing to 2, excellent. But the same method is called when opening the document, how to solve it? thanks for reply. (yes vba updating the ribbon control status)
    Last edited by md93150; 02-21-2018 at 10:40 AM.

  4. #4
    Valued Forum Contributor
    Join Date
    04-24-2014
    Location
    United States
    MS-Off Ver
    Office 365 ProPlus
    Posts
    853

    Re: A Ribbon control event can call another ribbon control event ?

    I'm just a little confused. Would clicking the button being updating the same thing to the dropdown list each time? Or are you planning to have multiple buttons or other to update the drop down list?

    I just saw your sample code. Are you doing this all within VBA or anything with RibbonX? Its been a long time since I worked with the ribbonx, but had always thought of it as 'fun' stuff.
    Last edited by ptmuldoon; 02-21-2018 at 10:09 AM.

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

    Re: A Ribbon control event can call another ribbon control event ?

    When first loaded the callbacks will fire, same as invalidate.
    You need to add code to determine what to do under what circumstances.

+ 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. Vba to Control Ribbon Tab
    By zplugger in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-24-2016, 03:47 PM
  2. Hide specific ribbon control/tab
    By alimsab in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-26-2015, 01:16 PM
  3. [SOLVED] Call userform control click event indirectly
    By ryan.wherry in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 03-26-2015, 11:42 AM
  4. [SOLVED] Any way to avoid hardcoding control name inside the control event procedure?
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 03-24-2015, 07:50 PM
  5. [SOLVED] Userform multipage control - exit event not firing or event order
    By jane serky in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-14-2013, 10:23 AM
  6. How to re-enable a ribbon control.
    By Caula in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-23-2011, 09:10 AM
  7. [SOLVED] call a function on control click event
    By tkraju via OfficeKB.com in forum Excel General
    Replies: 4
    Last Post: 08-23-2006, 12:55 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