commandbar hunt

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
 
R

Rob Bovey

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

defj

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 *





.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top