Consulting

Results 1 to 4 of 4

Thread: Refresh ribbon with code

  1. #1

    Refresh ribbon with code

    Hello everyone,I created a custom ribbon for myself using xml
    I have a part in xml code like this
    <checkBox id = "Fnew" getLabel="CallbackGetLabel" getPressed="GetPressed" onAction="KOLONAC" />
    and vba code for this part is

    Dim bChk(0 to 2) As Boolean
    Public objRibbon As IRibbonUI
    Private Sub o n l o a d(ribbon As IRibbonUI)
    Dim i As Long
      Set objRibbon = ribbon
      bChk(0) = True
    End Sub
    
    Function GetChkBox(ByVal sString) As String
    Select Case sString
    Case "Fnew"
    GetChkBox = "0"
    End Select
    End Function
    
    Sub GetPressed(control As IRibbonControl, ByRef Button)
    Button = bChk(GetChkBox(control.ID))
    End Sub
    
    Sub CallbackGetLabel(control As IRibbonControl, ByRef Label)
    On Error Resume Next
    Select Case control.ID
    Case "Fnew"
    Label = Range("B12").Value
    End Select
    End Sub

    And when I change range("b12").value with another macro,getpressed is not shown anymore.
    Can you help me about that?
    Best Regards

  2. #2

  3. #3
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    Are you invalidating the control/ribbon? If not, the callback won't get called to update the label text.
    Be as you wish to seem

  4. #4
    Simply: objRibbon.invalidate

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •