#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default toolbars

Hello,
I have a custom toolbar. that I have created by hand. Then attached into a
workbook.
Is there a way to enable or disable buttons on this?
I looked in the object browser. But there does not seem to be any toolbar
object.

thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default toolbars

Sub test()
Dim cbr As CommandBar, ctr As Object

Set cbr = Application.CommandBars("MyCustomBar")
cbr.Visible = True ' false

'' either disable the toolbar, uncomment following
' cbr.Enabled = False ' True to re-enable

' or 'grey-out' all the controls
For Each ctr In cbr.Controls
ctr.Enabled = False
Next

End Sub

Regards,
Peter T

"greg" wrote in message
...
Hello,
I have a custom toolbar. that I have created by hand. Then attached into

a
workbook.
Is there a way to enable or disable buttons on this?
I looked in the object browser. But there does not seem to be any toolbar
object.

thanks




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 533
Default toolbars

Use the Commandbars object:

Commandbars("MyBar").Controls(1).Enabled = False

or

Commandbars("MyBar").Controls("MyBtn).Enabled = False

It is far better though to create the toolbar "by code" rather than "by
hand". You can attach a toolbar to a workbook but then it takes on a life
of its own. Close the workbook and it's still there. Close Excel and open
it and it's still there...

--
Jim
"greg" wrote in message
...
Hello,
I have a custom toolbar. that I have created by hand. Then attached into
a workbook.
Is there a way to enable or disable buttons on this?
I looked in the object browser. But there does not seem to be any toolbar
object.

thanks




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default toolbars

Ah thanks
toolbars = CommandBars



"Peter T" <peter_t@discussions wrote in message
...
Sub test()
Dim cbr As CommandBar, ctr As Object

Set cbr = Application.CommandBars("MyCustomBar")
cbr.Visible = True ' false

'' either disable the toolbar, uncomment following
' cbr.Enabled = False ' True to re-enable

' or 'grey-out' all the controls
For Each ctr In cbr.Controls
ctr.Enabled = False
Next

End Sub

Regards,
Peter T

"greg" wrote in message
...
Hello,
I have a custom toolbar. that I have created by hand. Then attached
into

a
workbook.
Is there a way to enable or disable buttons on this?
I looked in the object browser. But there does not seem to be any
toolbar
object.

thanks






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Toolbars dstiefe Excel Discussion (Misc queries) 2 August 3rd 05 08:52 PM
Please Help, No Toolbars in my view-toolbars! [email protected] Excel Programming 2 February 19th 05 09:15 PM
Toolbars Inbar Excel Programming 0 August 16th 04 05:51 PM
toolbars Ronbo Excel Programming 0 May 17th 04 08:20 PM
toolbars POPPY Excel Programming 4 April 16th 04 10:04 PM


All times are GMT +1. The time now is 10:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"