LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Hiding a toolbar

I have a floating toolbar in a workbook. On certain worksheets where it is
not applicable, I want to hide it. I can do it without any problem with
following code:

Private Sub Worksheet_Activate()

If CommandBars("Custom Toolbar").Visible = True Then
CommandBars("Custom Toolbar").Visible = False
End If

End Sub

Since the toolbar is specific to the workbook, I also want to hide it when
another workbook is activated. So I try same code as above:

Private Sub Workbook_Deactivate()

If CommandBars("Custom Toolbar").Visible = True Then
CommandBars("Custom Toolbar").Visible = False
End If

End Sub

However this time I have a problem. The error message is
"CommandBars("Custom Toolbar")=...Object variable or with block variable not
set". I am not sure what the problem is since same code works in the the
case of worksheets.


 
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
toolbar "button" for hiding/unhiding sheets Barb in MD Excel Worksheet Functions 2 February 10th 10 01:45 AM
Hiding Control Toolbar Checkboxes Ellen G Excel Discussion (Misc queries) 2 September 24th 07 09:59 PM
Hiding a button when hiding rows fergusor Excel Discussion (Misc queries) 2 August 10th 06 02:31 PM
Hiding the Standard Toolbar Andy T Excel Discussion (Misc queries) 2 December 15th 04 05:25 PM
hiding menubar & toolbar SIMONÉ Excel Programming 1 January 21st 04 04:31 PM


All times are GMT +1. The time now is 03:41 PM.

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

About Us

"It's about Microsoft Excel"