Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
commandbar hunt
is there a way to check and see if a custom commandbar
exists? I have a commandbar that is created at runtime. The problem is when you open 2 versions of the workbook, it errors out because a commandbar already exists with the same name (makes sense). I tried just adding a delete commandbar on the open event (then rebuilding the commandbar), the problem here is if it's the first time you've opened the sheet...can't find the commandbar I want it to delete (also makes sense). Because it's custom, searching by ID doesn't seem to work...ARRGGGGHHH thnks in advance |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
commandbar hunt
Try the following to delete your command bar in the Open event (which I
think is the best choice, because it solves some other problems as well): On Error Resume Next CommandBars("MyCommandBar").Delete On Error Goto 0 Replace "MyCommandBar" with whatever your commandbar name is. This will delete the commandbar if it exists and fail silently if it doesn't. -- Rob Bovey, MCSE, MCSD, Excel MVP Application Professionals http://www.appspro.com/ * Please post all replies to this newsgroup * * I delete all unsolicited e-mail responses * "defj" wrote in message ... is there a way to check and see if a custom commandbar exists? I have a commandbar that is created at runtime. The problem is when you open 2 versions of the workbook, it errors out because a commandbar already exists with the same name (makes sense). I tried just adding a delete commandbar on the open event (then rebuilding the commandbar), the problem here is if it's the first time you've opened the sheet...can't find the commandbar I want it to delete (also makes sense). Because it's custom, searching by ID doesn't seem to work...ARRGGGGHHH thnks in advance |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
commandbar hunt
many thanks
-----Original Message----- Try the following to delete your command bar in the Open event (which I think is the best choice, because it solves some other problems as well): On Error Resume Next CommandBars("MyCommandBar").Delete On Error Goto 0 Replace "MyCommandBar" with whatever your commandbar name is. This will delete the commandbar if it exists and fail silently if it doesn't. -- Rob Bovey, MCSE, MCSD, Excel MVP Application Professionals http://www.appspro.com/ * Please post all replies to this newsgroup * * I delete all unsolicited e-mail responses * "defj" wrote in message ... is there a way to check and see if a custom commandbar exists? I have a commandbar that is created at runtime. The problem is when you open 2 versions of the workbook, it errors out because a commandbar already exists with the same name (makes sense). I tried just adding a delete commandbar on the open event (then rebuilding the commandbar), the problem here is if it's the first time you've opened the sheet...can't find the commandbar I want it to delete (also makes sense). Because it's custom, searching by ID doesn't seem to work...ARRGGGGHHH thnks in advance . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Setting up Treasure Hunt spreadsheet | Excel Discussion (Misc queries) | |||
commandbar problems | Excel Discussion (Misc queries) | |||
Moving CommandBar using VBA or C# | Excel Programming | |||
Commandbar Mystery | Excel Programming | |||
Code to Hunt Linked Cells | Excel Programming |