View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
XP XP is offline
external usenet poster
 
Posts: 389
Default Call a callback to toggle a tab visible/hidden?

Hi Melanie,

Excellent; thank you so much!!!

Regards from USA

"Melanie Breden" wrote:

Hi,

"XP" schrieb:
I have the tab written in XML and the following call back works, but only
each time the file is closed and reopened. How can I make this more fluid so
it updates immediately without having to close and reopen the file? Is there
a way I can call the Callback below to make it run again?


look at the following example:

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"
onLoad="rx_onLoad"
<ribbon
<tabs
<tab id="tab_1" label="Custom tab" getVisible="getVisibleCallback" /
</tabs
</ribbon
</customUI

' Modul1
Public objRibbon As IRibbonUI

Public Sub rx_onLoad(ribbon As IRibbonUI)
Set objRibbon = ribbon
End Sub

Public Sub getVisibleCallback(control As IRibbonControl, ByRef visible As Variant)
visible = Worksheets("Sheet1").Range("A1").Value < ""
End Sub

' Codemodule Sheet1
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(0, 0) < "A1" Then Exit Sub
objRibbon.InvalidateControl "tab_1"
End Sub


Mit freundlichen Grüssen
Melanie Breden

- Microsoft MVP für Excel -