ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Right click event (https://www.excelbanter.com/excel-programming/366015-right-click-event.html)

dev

Right click event
 
How to capture "Clear Contents" Excel right click context menu option.

I want to run a piece of code when user right clicks on a cell and selects
"Clear Contents" context menu option.

Chip Pearson

Right click event
 
Dev,

Put the following code in the ThisWorkbook module.

Private WithEvents Ctrl As CommandBarButton

Private Sub Ctrl_Click(ByVal Ctrl As Office.CommandBarButton,
CancelDefault As Boolean)
MsgBox "Hello World"
End Sub

Private Sub Workbook_Open()
Set Ctrl = Application.CommandBars.FindControl(ID:=3125)
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Dev" wrote in message
...
How to capture "Clear Contents" Excel right click context menu
option.

I want to run a piece of code when user right clicks on a cell
and selects
"Clear Contents" context menu option.




dev

Right click event
 
Thanks Chip - this worked great!!.

Do you know the ID for "Insert Copied Cells..."?

"Chip Pearson" wrote:

Dev,

Put the following code in the ThisWorkbook module.

Private WithEvents Ctrl As CommandBarButton

Private Sub Ctrl_Click(ByVal Ctrl As Office.CommandBarButton,
CancelDefault As Boolean)
MsgBox "Hello World"
End Sub

Private Sub Workbook_Open()
Set Ctrl = Application.CommandBars.FindControl(ID:=3125)
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Dev" wrote in message
...
How to capture "Clear Contents" Excel right click context menu
option.

I want to run a piece of code when user right clicks on a cell
and selects
"Clear Contents" context menu option.





dev

Right click event
 
I think I got it... it's 3181

"Dev" wrote:

Thanks Chip - this worked great!!.

Do you know the ID for "Insert Copied Cells..."?

"Chip Pearson" wrote:

Dev,

Put the following code in the ThisWorkbook module.

Private WithEvents Ctrl As CommandBarButton

Private Sub Ctrl_Click(ByVal Ctrl As Office.CommandBarButton,
CancelDefault As Boolean)
MsgBox "Hello World"
End Sub

Private Sub Workbook_Open()
Set Ctrl = Application.CommandBars.FindControl(ID:=3125)
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Dev" wrote in message
...
How to capture "Clear Contents" Excel right click context menu
option.

I want to run a piece of code when user right clicks on a cell
and selects
"Clear Contents" context menu option.






All times are GMT +1. The time now is 04:20 PM.

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