Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting up Treasure Hunt spreadsheet Rachael Excel Discussion (Misc queries) 11 September 13th 08 02:06 AM
commandbar problems Richard Cook Excel Discussion (Misc queries) 1 July 8th 05 05:32 PM
Moving CommandBar using VBA or C# Aaron Queenan Excel Programming 1 October 31st 03 03:20 PM
Commandbar Mystery Quaoar Excel Programming 2 September 29th 03 03:12 AM
Code to Hunt Linked Cells Phil Hageman Excel Programming 2 July 16th 03 01:31 PM


All times are GMT +1. The time now is 02:22 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"