Run-time error

B

Beek

I am trying to modify a context menu from the explorer in outlook (2002 SP3) with the following code.


Private WithEvents explCommandBars as Office.CommandBars

Private Sub explCommandBars_OnUpdate()

Dim bar as CommandBar

Set bar = explCommandBars.Item("Context Menu")
If Not bar Is Nothing Then

Set ctlCB = bar.FindControl(msoControlButton, 478)
If Not ctlCB Is Nothing Then
ctlCB.Enabled = False
End If
End If
End Sub

When running (in debug mode) I get the error:

Run-time error '-2147467259 (80004005)':

Method 'Enabled' of object '_CommandBarButton' failed


is tehre a solution for this
 
Top