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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Greyed out toolbar buttons

Status
Not open for further replies.

AcousticalConsultant

Technical User
Sep 20, 2001
45
CA
Here's another question regarding toolbars:

Is there any way of greying out custom toolbar buttons? Like for example when there are no documents opened, the "save" button is shaded out. If it's possible, where do I define my condition?

Thanks in advance!
 
JoaoTL,

Well that's not really what I was looking for. I know how to create and customize the toolbar, but I wanted the buttons on the toolbar to be shaded out when certain conditions were true (I wanted them to be active only when a specific document was opened).

So I used this:

Private Sub Workbook_BeforeClose(Cancel as Boolean)
Application.CommandBars("myBar").Controls(1).Enabled = False
End Sub

To disable the button when I close the document, and then:

Private Sub Workbook_Open()
Application.Commandbars("myBar").Controls(1).Enabled = True
End Sub

To re-enable the button when the document has been opened.

Thanks anyway!
Have a good one.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top