Cell shortcut menu no longer works in Excel 365

spidaman

Board Regular
Joined
Jul 26, 2015
Messages
116
Office Version
  1. 365
Platform
  1. Windows
Can anyone using Excel 365 please help me identify the problem with a cell shortcut menu added as a workbook open routine?

In Excel 2013 the below code previously created a shortcut right-click menu from any cell. However since migrating to Excel 365 it no longer functions. I have tried various fixes and searched high and low for an answer but unsure why the code no longer works. The procedure is placed in the ThisWorkbook module.


VBA Code:
Private Sub Workbook_Open()

Shortcuts

End Sub


Public Sub Shortcuts()

Dim MyMenu As Object

    Set MyMenu = Application.ShortcutMenus(xlWorksheetCell).MenuItems.AddMenu("Countries", 1)

        With MyMenu.MenuItems
            .Add "CAN", "CAN_cut", , 1, , ""
            .Add "ESP", "ESP_cut", , 2, , ""
            .Add "FRA", "FRA_cut", , 3, , ""
            .Add "GBR", "GBR_cut", , 4, , ""
            .Add "USA", "US_cut", , 5, , ""
        End With

    Set MyMenu = Nothing

End Sub

Thanks in advance for any suggestions.
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Macro blocked by security settings?

I just tried your code with 365 and it works fine.
 
Upvote 0
Try adding a message box to see if the code runs
VBA Code:
Private Sub Workbook_Open()
MsgBox "ok"
Shortcuts

End Sub
 
Upvote 0
Macro blocked by security settings?

I just tried your code with 365 and it works fine.
It can't be as I have all macros enabled in settings - see attached
 

Attachments

  • Settings.PNG
    Settings.PNG
    11.5 KB · Views: 3
Upvote 0
Try adding a message box to see if the code runs
VBA Code:
Private Sub Workbook_Open()
MsgBox "ok"
Shortcuts

End Sub
Hi Fluff - I tried this and the msgbox does run successfully on start-up.....so seems ok
 
Upvote 0
In that case it should work.
If I run your code I get the Countries as the 1st item in the right click menu, unless I try it in a structured table.
 
Upvote 0
In that case it should work.
If I run your code I get the Countries as the 1st item in the right click menu, unless I try it in a structured table.
Yes that's how it presented in 2013 version for me. It's a strange one. I couldn't see any reason why it shouldn't run. Please let me know if you have any other thoughts. There are some other open workbook procedures that might be causing complications but nothing that wasn't already added in the 2013 version. I'll try experimenting more anyway.

Thanks for your help.
 
Upvote 0
Try using a Stop command instead of the message box that Fluff suggested, then use f8 to step through the code and see if it appears then.

It didn't work for me first attempt so I tried the above and it worked fine, although I think that the initial fail was due to me right clicking in a table which is why I didn't mention in previously.
 
Upvote 0

Forum statistics

Threads
1,214,895
Messages
6,122,128
Members
449,066
Latest member
Andyg666

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