LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Trouble with modifying cell right-mouse-click context menu

Question relates to modifying the right-mouse-click cell context menu in
Excel 2007

I am attempting to add a menu item to the cell context menu that pops up
upon clicking the right mouse button. I found a microsoft article he
http://msdn.microsoft.com/en-us/library/bb211466.aspx that seems to explain
how to do this. Based on this article, I have inserted VBA code into the
worksheet of interest as follows:

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, _
Cancel As Boolean)
For Each icbc In Application.CommandBars("cell").Controls
If icbc.Tag = "RollJob" Then icbc.Delete
Next icbc

With Application.CommandBars("cell").Controls _
.Add(Type:=msoControlButton, befo=6, _
temporary:=True)
.Caption = "Roll Job"
.OnAction = "RollJob"
.Tag = "RollJob"
End With

End Sub

Private Sub Worksheet_Deactivate()

For Each icbc In Application.CommandBars("cell").Controls
If icbc.Tag = "RollJob" Then icbc.Delete
Next icbc

End Sub

RollJob is a macro in a module within the same workbook.

When I right-click in this sheet, nothing in the context menu appears to
have changed. Can anyone figure out what I am doing wrong here?
 
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
Right click menu (context menu) for Rows & col not working Madiya Excel Programming 5 December 26th 09 10:07 AM
Screwed Up my Right Click Context Menu, Please Help cpmame Excel Programming 11 March 12th 09 10:59 PM
Undo button in the context menu (right click menu) Madiya Excel Programming 7 April 7th 08 04:33 PM
Custom Context menu (Right click menu) not working in sheet changeevent. Madiya Excel Programming 3 February 11th 08 01:24 PM
Right-Click (Context Menu) Kryptonix Excel Programming 6 October 25th 05 03:59 PM


All times are GMT +1. The time now is 04:04 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"