Clearing Legacy Word 2003 Macro Icons from Word 2010 Add-Ins Bar

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.

Per this doco : http://blogs.msdn.com/b/cristib/archive/2012/03/30/vba-how-to-find-and-edit-the-office-2003-legacy-commandbars-and-menus-in-office-2010-add-remove-edit-controls-in-menu-commands-group-from-add-ins-tab.aspx

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

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...