Deleting a Menu Bar

S

Sophie

Hello Everyone!

A spreadsheet that I've used has set up a new drop down
menu at the top of my Excel application. (Like File, Edit
etc). Now I want to get rid of it.

I've had a good look through the postings on here and
can't find a way. I think I need to somehow list all
the ??msoControlDropdown?? options then delete the name
of the one I don't want. But everything on here seems to
refer to adding and deleting a specific name that you
already know!

If anyone could help I'd be very grateful

TIA

Sxx
 
R

Rob van Gelder

I have some examples of commandbars on my website.

If you've set the Tag property on a control, you can use the .Find method of
Controls to find using Tag parameter.
 
G

Guest

Hi Rob

Thanks for that. With your help I managed to put together
the code below. But when I ran it displayed the Gotcha!
and deleted the dropdown options from the menu I wanted
to remove, but the header is still there!!

Sub ListAllMenubars()

Dim bar As CommandBar

For Each bar In Application.CommandBars

ActiveCell.Offset(1, 0).Select
ActiveCell.value = bar.Name

If bar.Name = "Financial &Manager" Then
MsgBox "Gotcha!"
bar.Delete
End If
Next

End Sub
 
D

Dave Peterson

maybe just:

On Error Resume Next
Application.CommandBars("worksheet menu bar") _
.Controls("Financial &Manager").Delete
On Error GoTo 0

(if I understood correctly)
 
R

Rob van Gelder

Not sure what's going on...

Code looks like it should delete the commandbar "Financial &Manager"
How are you triggering ListAllMenubars to run?
 
Top