Cannot remove custom commands from 2007 add-ins tab

G

George Burdell

Greetings. we have code that worked fine in 2003 to add menu items to the
Tools menu and then remove them when Excel closed. Now in 2007, the code
adds the menu items to the Add-ins tab as a "custom command". And the code
that removed the additions from the Tools menu does not remove the additions
to the Add-ins tab. The code is looking for additions to the Tools menu,
which obviously didn't happen.

I can find no reference to a custom commands collection and thus can find no
way to remove the additions to the Add-ins tab. Even worse, the additions to
the Add-ins tab increases each time the workbooks are opened. As we have
quite a few workbooks that add menu items to the Tools menu, the Add-in tab
is getting cluttered.

We have found that deleting the XLB file at least resets the Add-in tab. It
also is not a satisfactory solution for obvious reasons.

So, how does one use code to remove the custom commands that Excel puts
under the Add-in tab?

Help!

George
 
J

Jim Rech

I find this code works as expected to add a command to the add-ins tab and
remove it.

Sub AddToTools()
With CommandBars("Tools").Controls.Add(msoControlButton)
.Caption = "My Command"
End With
End Sub

Sub RemoveFromTools()
CommandBars("Tools").Controls("My Command").Delete
End Sub

Can you post code (slimmed down to its essentails) that shows the problem?
 

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