Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Adding a separator to a context menu

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding commands to the Excel 2007 Chart context menu Andreas Charts and Charting in Excel 1 January 23rd 09 08:15 PM
Context Menu (Sub-Menu Disable/Enable) JR_06062005[_2_] Excel Programming 4 August 31st 06 06:01 PM
Disable Sub-Menu of a Context Menu JR_06062005[_2_] Excel Programming 1 August 29th 06 09:46 PM
Context Menu nrussell Excel Programming 0 September 29th 05 10:08 AM
Adding Separator Menu Item - Excel 2003 Desi Excel Programming 2 June 9th 05 10:21 AM


All times are GMT +1. The time now is 10:17 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"