LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Deleting CommandBar("").Controls

Is it possible to use a WorksheetFunction when looking at CommandBar
data? What i'm trying to do is search the names of the CommandBars
and delete any that contains a certain string. I've got the function
written to remove the ampersand and could write one to find the
string, but is there a way to use the .Find function to do this?

I've tried a couple different ways and can't think of how to get it to
work... any ideas?


Sub AddMenuItems()

For Each ctl In Application.CommandBars("Worksheet Menu
Bar").Controls
header_name = ctl.Caption
head_count = Len(header_name)
For i = 1 To Len(header_name)
If Right(Left(header_name, i), 1) = "&" Then
header_name = Left(header_name, i - 1) & _
Right(header_name, head_count - i)
End If
Next

'With header_name
' c = header_name.Find( _
' what:=find_item, _
' MatchCase:=False)
'End With
find_item = "String to look for"
a = WorksheetFunction.Find(find_item, header_name, 1)

found_MP = header_name.indexof(find_item)

Next

End Sub

Sub Auto_Open()
AddMenuItems
End Sub


Thanks,
Thedude
 
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
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
"Start a new group" coding possible for a commandbar (floating toolbar)? StargateFanFromWork[_3_] Excel Programming 0 June 19th 06 03:49 PM
CommandBars("Worksheet Menu Bar").Controls("Tools").Enabled = Fals Arturo Excel Programming 3 May 26th 05 05:44 PM
"Document Recovery" grey commandbar Dev Ashish Excel Programming 2 November 6th 04 05:36 PM
Can ActiveX controls be "disabled" and "enabled"? William DeLeo Excel Programming 1 May 7th 04 09:10 PM


All times are GMT +1. The time now is 06:37 AM.

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

About Us

"It's about Microsoft Excel"