ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Custom Right Click--VBA? (https://www.excelbanter.com/excel-programming/429665-custom-right-click-vba.html)

dgold82

Custom Right Click--VBA?
 
I have an interesting project here. I have disabled all the command bars and
toolbars with VBA code--which is great for my purposes--but I would like to
create a custom right click (not a toolbar which I know how to do) with
certain commands. Is that possible? I would like to put a couple things like
"clear contents" for a radio button and print sheet and "Home" which would
hyperlink my user back to a certain worksheet.

Can anyone help me with code to do this? Here is what I use now to disable
everything:

Private Sub Workbook_WindowActivate(ByVal Wn As Window)
Application.DisplayFormulaBar = false
ActiveWindow.DisplayHeadings = false
Application.DisplayStatusBar = false
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",false)"

'This will disable all Command bars
Dim Cbar As CommandBar
For Each Cbar In Application.CommandBars
Cbar.Enabled = false
Next

End Sub


Private Sub Workbook_WindowDeactivate(ByVal Wn As Window)
Application.DisplayFormulaBar = True
ActiveWindow.DisplayHeadings = True
Application.DisplayStatusBar = True
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",true)"

'This will disable all Command bars
Dim Cbar As CommandBar
For Each Cbar In Application.CommandBars
Cbar.Enabled = True
Next
End Sub




All times are GMT +1. The time now is 11:39 AM.

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