View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Adding a separator to a context menu

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As
Boolean)
Dim icbc As Object
For Each icbc In Application.CommandBars("cell").Controls
If icbc.Tag = "brccm" Then icbc.Delete
Next icbc
If Not Application.Intersect(Target, Range("RiskItems")) Is Nothing Then
With Application.CommandBars("cell").Controls _
.Add(Type:=msoControlButton, temporary:=True)
.BeginGroup = True
.Caption = "Access Risk List"
.OnAction = "ShowList"
.Tag = "brccm"
End With
End If
End Sub

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Goody" wrote in message
...
I want to add a separator line to isolate the new option I added to the end
of a context menu. I have not been able to find the necessary code. My
code
to add the item is taken from a Microsoft example, but I'm not sure it's
as
efficient as it could be:

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As
Boolean)
Dim icbc As Object
For Each icbc In Application.CommandBars("cell").Controls
If icbc.Tag = "brccm" Then icbc.Delete
Next icbc
If Not Application.Intersect(Target, Range("RiskItems")) Is Nothing
Then
With Application.CommandBars("cell").Controls _
.Add(Type:=msoControlButton, temporary:=True)
.Caption = "Access Risk List"
.OnAction = "ShowList"
.Tag = "brccm"
End With
End If
End Sub