Is it possible to customize the "right click" menu

Mulderitsme

New Member
Joined
Jan 19, 2005
Messages
2
Hi, does anyone know if it's possible to customize the right click menu in Excel 2003? For example, I'd like to get "page setup" onto that menu.

Thanks,
Terri
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
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.
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,751
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top