Ribbon getVisible not called when used with a Qualified ID

395 views
Skip to first unread message

John Le

unread,
Sep 15, 2017, 5:13:08 AM9/15/17
to Excel-DNA
Hi Govert,

I have a Ribbon that have group that have idQ to able to share with another add-in to expand or something else
But it doesn't run getVisible callback when used with a Qualified ID
You can follow the Ribbon's XML and code as below
Please help on it or Is there any solution or work-around?

http://msdn.microsoft.com/en-us/library/aa722523%28office.12%29.aspx

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"
  xmlns:x="myNameSpace" onLoad="rbxLoad">
  <ribbon>
    <tabs>
      <tab idMso="TabAddIns">
        <group idQ="x:Contoso" label="Contoso" getVisible="myxx">
          <button id="C1" label="Contoso Button 1" size="large"
            imageMso="FileSave" onAction="c_action1" />
        </group>
        <group id="Contoso" label="Contoso2" getVisible="myxx">
          <button id="C2" label="Contoso Button 2" size="large"
            imageMso="FileSave" onAction="c_action1" />
        </group>
      </tab>
    </tabs>
  </ribbon>
</customUI>

With the following VBA code

' Code in standard module

Public g_rbxUI As IRibbonUI
Public g_blnVis As Boolean
Sub rbxLoad(ribbon As IRibbonUI)
Stop
  Set g_rbxUI = ribbon
End Sub
'Callback for Contoso getVisible
Sub myxx(control As IRibbonControl, ByRef returnedVal)

  MsgBox "Get Visible"
  returnedVal = g_blnVis
End Sub

'Callback for C1 onAction
Sub c_action1(control As IRibbonControl)

  MsgBox "Here"
  
End Sub

 

' code in Thisworkbook object

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
  
  g_blnVis = Not g_blnVis
 
  g_rbxUI.Invalidate

' also tried invalidating the control
' g_rbxUI.InvalidateControl "Contoso" End Sub


Thanks in advance,
Phuong Le.

John Le

unread,
Sep 15, 2017, 5:16:45 AM9/15/17
to Excel-DNA
Please note that. It doesn't work on Excel 2013 and 2010

Govert van Drimmelen

unread,
Sep 15, 2017, 5:40:04 AM9/15/17
to exce...@googlegroups.com
I can see how this limitation might be 'by design' but don't have any documentation that calls it out and don't know of a workaround.


-Govert
--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.
To post to this group, send email to exce...@googlegroups.com.
Visit this group at https://groups.google.com/group/exceldna.
For more options, visit https://groups.google.com/d/optout.

Gareth Hayter

unread,
Oct 15, 2018, 7:14:39 PM10/15/18
to Excel-DNA
FYI, it appears that 'image' and 'getImage' also have the same issue. A sub-optimal workaround for specifying an image is to use imageMso, however you are obviously limited to using the built-in images.

Gareth.
Reply all
Reply to author
Forward
0 new messages