Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Command Bar (help!)


I took this VBA out of the tips and must have used in incorrectly.
Maybe a bad choice for my second one to try. I placed it in the ope
command and it took away the menu bars but I cant get them toggle
back. It shows that way on all of my excel application. Help


Sub ToggleCommandBars()
Dim cbEnabled As Boolean
' get the current commandbar state
cbEnabled = Not Application.CommandBars(1).Enabled
' apply the new state to the Workbook Menu Bar
Application.CommandBars(1).Enabled = cbEnabled
' apply the new state to the Standard toolbar
Application.CommandBars("StandardOPE").Enabled = cbEnabled
' apply the new state to a custom commandbar (the oposite of th
previous two)
Application.CommandBars("MyCustomCommandBar").Enab led = No
cbEnabled
End Su

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Command Bar (help!)

Mike,

It seems to work okay for me (although I don't have toolbars named
StandardOPE and MyCustomCommand, but I tried with Formatting).

If you run it initially (in workbook open?), where are you then trying to
run it for the toggle?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"mikegospo" wrote in message
...

I took this VBA out of the tips and must have used in incorrectly.
Maybe a bad choice for my second one to try. I placed it in the open
command and it took away the menu bars but I cant get them toggled
back. It shows that way on all of my excel application. Help


Sub ToggleCommandBars()
Dim cbEnabled As Boolean
' get the current commandbar state
cbEnabled = Not Application.CommandBars(1).Enabled
' apply the new state to the Workbook Menu Bar
Application.CommandBars(1).Enabled = cbEnabled
' apply the new state to the Standard toolbar
Application.CommandBars("StandardOPE").Enabled = cbEnabled
' apply the new state to a custom commandbar (the oposite of the
previous two)
Application.CommandBars("MyCustomCommandBar").Enab led = Not
cbEnabled
End Sub


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by step guide to

creating financial statements


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Command Bar (help!)

Run it a second time.

--
Regards,
Tom Ogilvy

"mikegospo" wrote in message
...

I took this VBA out of the tips and must have used in incorrectly.
Maybe a bad choice for my second one to try. I placed it in the open
command and it took away the menu bars but I cant get them toggled
back. It shows that way on all of my excel application. Help


Sub ToggleCommandBars()
Dim cbEnabled As Boolean
' get the current commandbar state
cbEnabled = Not Application.CommandBars(1).Enabled
' apply the new state to the Workbook Menu Bar
Application.CommandBars(1).Enabled = cbEnabled
' apply the new state to the Standard toolbar
Application.CommandBars("StandardOPE").Enabled = cbEnabled
' apply the new state to a custom commandbar (the oposite of the
previous two)
Application.CommandBars("MyCustomCommandBar").Enab led = Not
cbEnabled
End Sub


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by step guide to

creating financial statements


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Command Bar (help!)


Man you guys are quick, I found a way to fix it in an old forum

Sub test()
Application.CommandBars(1).Enabled = True
End Sub


Now I also found how to make them disappear and reappear

Private Sub Workbook_Activate()
Dim bar As CommandBar
For Each bar In Application.CommandBars
bar.Enabled = False
Next
End Sub

Private Sub Workbook_Deactivate()
Dim bar As CommandBar
For Each bar In Application.CommandBars
bar.Enabled = True
Next
End Sub


Next all I want is a print icon, I will have to research more.

Thanks again


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements
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
One command in one cell initiating another command in another cel. Chas52 Excel Worksheet Functions 3 November 7th 09 06:57 PM
command code ( GOTO command) in formula calan New Users to Excel 1 June 11th 09 09:44 AM
command button add another command Wanna Learn Excel Discussion (Misc queries) 5 December 7th 08 11:42 PM
Pivot Table Error Message - "Command Text not set for command obje Jeff Divian Excel Discussion (Misc queries) 0 November 7th 07 10:26 PM
Excel has a "Find Next" command but no "Find Previous" command. Michael Fitzpatrick Excel Discussion (Misc queries) 2 January 10th 05 11:45 PM


All times are GMT +1. The time now is 03:17 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"