Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Toolbar

Status
Not open for further replies.

ryne23

Programmer
Mar 9, 2001
29
US
I have created a custom toolbar using the wizard. Is there a way that I can gray out certain portions of the toolbar based on a security level number that I have implemented?

Thanks
Mike
 
Hi,

You can test for the security level and use:
Code:
[COLOR=blue]
    Dim cbrMyToolbar As CommandBar
    
    Set cbrMyToolbar = CommandBars("mnuMyToolbar")
        
    If Not blnHasAdmin Then [b]' Replace with your security check[/b]
        cbrMyToolbar.Controls([b]4[/b]).Enabled = False
        cbrMyToolbar.Controls([b]6[/b]).Enabled = False     
    Else
        cbrMyToolbar.Controls([b]4[/b]).Enabled = True
        cbrMyToolbar.Controls([b]6[/b]).Enabled = True
    End If
[/color]

CommandBars collection requires you to set a reference to Microsoft Office x.0 Object Library.

You need to change the index numbers for the controls (in bold above) to point to the buttons you want to disable. Count the position of the button starting from the left.
HTH. Good Luck,

Dean :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top