Re: Is it possible to customize the "right click"
Yes it is possible, here is one approach, assuming you want to keep the existing standard right click menu items intact. This will place a "Page Setup" script button item at the bottom of your right click menu, separated by a grouping bar.
In the workbook module:
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Sub Workbook_Open()
Run "MyRightClick"
End Sub
Private Sub Workbook_Activate()
Run "MyRightClick"
End Sub
Private Sub Workbook_WindowActivate(ByVal Wn As Window)
Run "MyRightClick"
End Sub
'
Private Sub Workbook_WindowDeactivate(ByVal Wn As Window)
Application.CommandBars("Cell").Reset
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars("Cell").Reset
ThisWorkbook.Save
End Sub
Private Sub Workbook_Deactivate()
Application.CommandBars("Cell").Reset
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
In a standard module:
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Sub MyRightClick()
Application.CommandBars("Cell").Reset
Dim cb As CommandBar, MenuObject
Set cb = Application.CommandBars("Cell")
Set MenuObject = cb.Controls.Add(Type:=msoControlButton, Temporary:=True)
With MenuObject
.Caption = "Page Setup"
.BeginGroup = True
.OnAction = "ShowPageSetup"
End With
End Sub
Private Sub ShowPageSetup()
Application.Dialogs(xlDialogPageSetup).Show
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Close the workbook, and when you reopen it next time and every time thereafter, or when you deactivate it and reactivate it every time thereafter, your right click menu will have that enhancement.