Hi, what is the problem? The code works for me by putting in the tab - and
does not call any macros - I removed CallbackOnRibbonLoad because I call
another routine. - but dumped it into my sample.dotm. It tried to open all 5
macros with error.
You might have to supply a macro sample - perhaps the code is incorrect?
"Axel"
news:fsinef$iag$03$1@news.t-online.com...
> Hi,
>
> in Word 2007 there is a global template "TEST.DOTM". Within the ribbon of
> this template I've created the new tab "Test" wich contains 5 button.
> Depending on user setting, some of these button should be visible and some
> should not - after TEST.DOTM is loaded as global template. Here is the
> code:
>
> XML code:
>
>
>
>
>
>
>
> > getVisible="CallbackGetVisible" tag="Macro1" />
>
> > getVisible="CallbackGetVisible" tag="Macro2" />
>
> > getVisible="CallbackGetVisible" tag="Macro3" />
>
> > getVisible="CallbackGetVisible" tag="Macro4" />
>
> > getVisible="CallbackGetVisible" tag="Macro5" />
>
>
>
>
>
>
>
>
> VBA code:
>
> Public gobjRibbon As IRibbonUI
> Public gbooRibbonButtonVisible As Boolean
>
> 'Global variable gobjRibbon intitialize at startup:
> Public Sub CallbackOnRibbonLoad(ribbon As IRibbonUI)
> Set gobjRibbon = ribbon
> gbooRibbonButtonVisible = False 'All button fade out
> End Sub
>
> 'Button visible/not visible:
> Public Sub CallbackGetVisible(control As IRibbonControl, ByRef visible As
> Variant)
> visible = gbooRibbonButtonVisible
> End Sub
>
> Public Sub AutoExec()
> Dim astrAllMacros(5) As String
> Dim intI As Integer, strX As String
>
> astrAllMacros(1) = "Button1"
> astrAllMacros(2) = "Button2"
> astrAllMacros(3) = "Button3"
> astrAllMacros(4) = "Button4"
> astrAllMacros(5) = "Button5"
>
> gbooRibbonButtonVisible = True
> strX = "10101" 'Only "Button1", "Button3" and "Button5" should be
> visible
> For intI = 1 To 5
> If Mid(strX, intI, 1) = "1" Then gobjRibbon.InvalidateControl
> astrAllMacros(intI)
> Next intI
> End Sub
>
> After that actually only "Button1", "Button3" and "Button5" should be
> visible, but there are ALL button visible. Why?
>
> I hope someone can help me.
>
> Thanks in advance!
> Axel
>