Hide Group Access 2007 Ribbon

mrgreen

Registered User.
Local time
Today, 05:04
Joined
Jan 11, 2008
Messages
60
Howdy,

Haven't posted in a while so I thought I'd drive someone crazy (hope not). My company recently moved into Office 2007 so I need a little assistance. I created my customized ribbon but I'm quite confused on how the callback works for getVisible or getEnabled. When I open the database the "Enter Observation" is disabled and the "Admin Options" is invisible every time!! Any help with what I'm missing would be great.

I only want this to check permissions when the user opens the db
<group id="grpAdmin" label="Admin Options" getVisible="CallbackGetVisible">
<menu id = "mnuadmin" label = "Admin Options">

I want to enable/disable controls based on the status of the entry
<menu id="mnuProjectsReports" label="Entry Options">
<button id="Button1" label="Enter Observation" imageMso="Paste" getEnabled="CallbackGetEnabled"
onAction="MacOpenEntryForm"/>


Option Compare Database
Option Explicit
Public bolEnabled As Boolean
Public bolVisible As Boolean
Sub CallbackGetEnabled(control As IRibbonControl, ByRef enabled)
bolEnabled = False
If Environ("USERNAME") = "myloginid" Then
bolEnabled = True
Else
enabled = True
End If
End Sub
Sub CallbackGetVisible(control As IRibbonControl, ByRef visible)
bolVisible = False
If Environ("USERNAME") = "myloginid" Then
bolVisible = True
Else
visible = True
End If
End Sub}

Any help would be wonderful!
 
Hi
I can't see the relevance of your two boolean flags in this code? It seems to me that the key is in the callback flags ("enabled" and "visible"). In essence, you need to set these to either "true" or "false" when the callback is invoked. So where you have "bolEnabled=True", subtitute "enabled=True" (likewise bolVisible).
I find it helpful to have a default setting to cover all eventualities, so I'd have something like this:
Sub CallbackGetEnabled(control As IRibbonControl, ByRef enabled)
enabled = False ' default setting
If Environ("USERNAME") = "myloginid" Then enabled = True
End Sub
I've simplified the IF statement as there is only one test in your example, but I would consider using a Select Case statement to determine all the True outcomes I wanted, or maybe a match on a query of valid users to determine the flag setting.
Hope this helps!
Nick H
 
Hi Nick, I know this is an older thread and I'm sorry for not getting back to you but thanks for the reply and yes what you gave me really helped. Thanks a bunch!!
 

Users who are viewing this thread

Back
Top Bottom