Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
delete toolbar
I have a button which creates, enables, and makes visible a toolbar. How do
I delete the toolbar when the user is done with it? I can make a toolbar button that deletes the toolbar, but how do I do this if the user uses the view menu or clicks the X in the corner of the toolbar to make it not visible? So, if the toolbar exists, I would like it to be visible, if it is not visible or made not visible, I don't want it to continue to exist. Any ideas? Thanks Dave |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
delete toolbar
Sorry, seem to have figured it out:
set cmdbar = application.commandbars.add("MyBar") with cmdbar .protection = msoBarNoChangeVisible + msoBarNoCustomize End with Thanks again Dave "drhalter" wrote: I have a button which creates, enables, and makes visible a toolbar. How do I delete the toolbar when the user is done with it? I can make a toolbar button that deletes the toolbar, but how do I do this if the user uses the view menu or clicks the X in the corner of the toolbar to make it not visible? So, if the toolbar exists, I would like it to be visible, if it is not visible or made not visible, I don't want it to continue to exist. Any ideas? Thanks Dave |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
delete toolbar
Hi Drhalter,
So, if the toolbar exists, I would like it to be visible, if it is not visible or made not visible, I don't want it to continue to exist. Any ideas? This gives you an idea how to create a bar that cannot be closed: Sub createbar() Dim oBar As CommandBar removebar Set oBar = CommandBars.Add oBar.Name = "Test" oBar.Protection = msoBarNoChangeVisible oBar.Visible = True End Sub Sub removebar() On Error Resume Next Application.CommandBars("Test").Delete End Sub Regards, Jan Karel Pieterse Excel MVP http://www.jkp-ads.com |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
delete toolbar
That's great. I posted just prior to yours, I happened to think of how to do
it about 2 seconds after I posted the original question. But, any ideas on how to test whether the toolbar exists? I have the following code in a workbook_sheetcalculate event: If application.commandbars("myBar").visible = true then but I get an error when myBar doesn't exist. The code works great when the toolbar does exist. Thanks Dave "Jan Karel Pieterse" wrote: Hi Drhalter, So, if the toolbar exists, I would like it to be visible, if it is not visible or made not visible, I don't want it to continue to exist. Any ideas? This gives you an idea how to create a bar that cannot be closed: Sub createbar() Dim oBar As CommandBar removebar Set oBar = CommandBars.Add oBar.Name = "Test" oBar.Protection = msoBarNoChangeVisible oBar.Visible = True End Sub Sub removebar() On Error Resume Next Application.CommandBars("Test").Delete End Sub Regards, Jan Karel Pieterse Excel MVP http://www.jkp-ads.com |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
delete toolbar
Hi Drhalter,
That's great. I posted just prior to yours, I happened to think of how to do it about 2 seconds after I posted the original question. But, any ideas on how to test whether the toolbar exists? I have the following code in a workbook_sheetcalculate event: If application.commandbars("myBar").visible = true then but I get an error when myBar doesn't exist. The code works great when the toolbar does exist. Dim oBar as CommandBar On Error Resume next Set oBar=Application.Commandbars("YourBar") If oBar is nothing then 'Bar is absent Else 'Do your thing End If Regards, Jan Karel Pieterse Excel MVP http://www.jkp-ads.com |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
delete toolbar
Thanks, that does it.
"Jan Karel Pieterse" wrote: Hi Drhalter, That's great. I posted just prior to yours, I happened to think of how to do it about 2 seconds after I posted the original question. But, any ideas on how to test whether the toolbar exists? I have the following code in a workbook_sheetcalculate event: If application.commandbars("myBar").visible = true then but I get an error when myBar doesn't exist. The code works great when the toolbar does exist. Dim oBar as CommandBar On Error Resume next Set oBar=Application.Commandbars("YourBar") If oBar is nothing then 'Bar is absent Else 'Do your thing End If Regards, Jan Karel Pieterse Excel MVP http://www.jkp-ads.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Help!! I am trying to delete a toolbar (avery) | Excel Discussion (Misc queries) | |||
permanently delete toolbar | Excel Discussion (Misc queries) | |||
delete control toolbar check box | Excel Discussion (Misc queries) | |||
How to Delete a persistent Toolbar? | Excel Discussion (Misc queries) | |||
delete custom toolbar | Excel Programming |