Context menu button appearing despite not being in solution

Add-in Express™ Support Service
That's what is more important than anything else

Context menu button appearing despite not being in solution
 
letdowncrush


Guest


Hi

When I right click on a Word document to get the context menu, there is a "adxCommandBarButton1" option at the bottom.

I can't find any reference to this in my solution - it may have been an old one I added when playing about.

There are no other add-ins being loaded.

I've tried cleaning / rebuilding, unregistering + registering the add in again.

Is there some kind of cache I can clear to get rid of this or any way of checking where it's coming from?

Thanks.
Posted 03 Jul, 2018 04:20:35 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello,

You can choose one of these ways:

- delete (rename) normal.dotm (see {user}\AppData\Roaming\Microsoft\Templates); this deletes the custom command bar controls, vba macros (if any), and some other settings such as default fonts used on a paragraph, etc.
- use code to find that control and delete it (see below). Saving the normal template after that is required. By default, the template is autosaved without a prompt; you can get such a prompt using the option "Prompt before saving Normal template"; see File | Options | Advanced.


Andrei Smolin
Add-in Express Team Leader

Note: I haven't tested deleting such a control; scanning does work.


Sub DeleteCommandBarControl()
Dim iBar As Integer
Dim iControl As Integer
For iBar = Application.CommandBars.Count To 1 Step -1
    Dim cBar As Office.CommandBar
    Set cBar = Application.CommandBars(iBar)
    ScanControls cBar.Controls
    Debug.Print cBar.Name
Next iBar
MsgBox "done"
End Sub

Sub ScanControls(ctrls As Office.CommandBarControls)
Dim iControl As Integer
For iControl = ctrls.Count To 1 Step -1
    Dim aControl As Office.CommandBarControl
    Set aControl = ctrls.Item(iControl)
    If aControl.Caption = "adxCommandBarButton1" Then
        aControl.Delete False ' delete permanently
    Else
        If TypeOf aControl Is Office.CommandBarPopup Then
            Dim popup As Office.CommandBarPopup
            Set popup = aControl
            ScanControls popup.Controls
        End If
    End If
Next iControl
Debug.Print "ScanControls", ctrls.Count
End Sub
Posted 04 Jul, 2018 03:04:53 Top