ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   shortcutmenu (https://www.excelbanter.com/excel-programming/282634-shortcutmenu.html)

DJ

shortcutmenu
 
I've created my own 'rightclick' menu that I have made pop-
up when I rightClick a cell. I've got the code working
but the How do I temporarily 'disappear' the shortcut menu
that regularly appears when I rightclick a cell. What's
the name of the menu (and ID...just in case I need to
restore it :| Also- is there a handy dandy ID list for
commandbars?

thanks in advance,
dj

Bob Phillips[_5_]

shortcutmenu
 
DJ,

Add this code to the sheet module where you want this custom right-click
menu.

Public fCustomCell As Boolean

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As
Boolean)
If fCustomCell Then
Cancel = True 'Supress builtin Cell menu
CommandBars("newCell").ShowPopup 'Show custom version
End If
End Sub

To make your menu the new right-click menu, set the variable fCustomCell,
like so

Sheet1.fCustomCell = True

To go back to normal, unset it, like so

Sheet1.fCustomCell = False


If you want it to apply to all sheets, use this event in the ThisWorkbook
vco0de module, with the same variable and same event code

Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal Target
As Range, Cancel As Boolean)

End Sub

In this instance, refer to the variab le like so

ThisWorkbook.fCustom Cell = True (or False)


This code will list all commandbars in a spare worksheet

Dim cb As CommandBar
Dim i As Long

i = 1
With Worksheets(3)
For Each cb In CommandBars
Cells(i, 1).Value = cb.Name
i = i + 1
Next cb
End With

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"dj" wrote in message
...
I've created my own 'rightclick' menu that I have made pop-
up when I rightClick a cell. I've got the code working
but the How do I temporarily 'disappear' the shortcut menu
that regularly appears when I rightclick a cell. What's
the name of the menu (and ID...just in case I need to
restore it :| Also- is there a handy dandy ID list for
commandbars?

thanks in advance,
dj





All times are GMT +1. The time now is 09:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com