commandbar hunt

  • Thread starter Thread starter defj
  • Start date Start date
D

defj

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
 
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 *
 
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 *





.
 
Back
Top