Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
One command in one cell initiating another command in another cel. | Excel Worksheet Functions | |||
command code ( GOTO command) in formula | New Users to Excel | |||
command button add another command | Excel Discussion (Misc queries) | |||
Pivot Table Error Message - "Command Text not set for command obje | Excel Discussion (Misc queries) | |||
Excel has a "Find Next" command but no "Find Previous" command. | Excel Discussion (Misc queries) |