During an Office 2003 Migration to 2010 , some custom Interwoven Macro’s got converted into a User’s Normal.dotm file from Normal.dot and Displayed in the Users Add-In. The buttons did nothing when you pressed them.
I tried to list all the controls using the below VB Script however the unlinked buttons where not listed, so I couldn’treference them in VB to remove by using :
Commandbars(1).Controls(“TheControl”).Delete
Sub ListAllControls()
Dim cmd As CommandBar
Dim ctr As CommandBarControl
Set cmd = Application.CommandBars("Menu Bar").Controls
On Error Resume Next
For Each ctrl In ctr.Controls
Debug.Print " " & ctrl.Caption & " "
For Each sub_ctrl In cmd.Controls
Debug.Print " >> Caption: " & sub_ctrl.Caption & vbTab & vbTab; " OnAction: " & sub_ctrl.OnAction
Next
Next
I could remove them using the Gui in Word “Delete custom command” , however needed to roll this out across multiple users.
Instead I had to run the following command : ( Either as immediate ) ( Alt F11 then Ctrl G ) or in the macro code for main() which reset the whole toolbar
CommandBars.ActiveMenuBar.Reset