none
How to disable the Copy command on context menus in Excel, Word, and PowerPoint when in protected view RRS feed

  • Question

  • Hello,

    Office 2016 8730.2046. I don't think however the issue relates to a certain Office build.

    The real problem is this: in protected view windows, only the tab and backstage related parts of the Ribbon XML are reflected in the UI of the host application; the context menu related part is ignored. You can create a VSTO add-in to check this. Alternatively, you can check the sample provided in Customizing Context Menus in All Versions of Microsoft Excel. Note that neither this page, nor Customizing Context Menus in Office 2010 mentions protected view windows.

    I've found a workaround for Excel: get an Excel.Application using ProtectedViewWindow.Workbook.Application, get the command bar named "Cells" in that Application object, find the Copy control (Id=19) and disable it. This approach doesn't work with PowerPoint when I try to customize the command bar named "Shapes".

    Do I miss a command bar in PP? Is there a specific commandbar in Word? Or, this is a restriction of the Ribbon UI?


    Regards from Belarus (GMT + 3),

    Andrei Smolin
    Add-in Express Team Leader

    Please mark answers and useful posts to help other developers use the forums efficiently.

    Thursday, November 23, 2017 12:10 PM

Answers

  • Hello,

    We do not find any method to disable the button in the context menu of Shape when opening the file protected view windows. 

    In Customizing Context Menus in All Versions of Microsoft Excel

    • In Excel 2007, you can add controls to almost every context menu with VBA code. However, it is not possible to change some context menus such as the Shapes and Picture context menu with VBA. In addition, it is not possible to change context menus with RibbonX.
    • In Excel 2010, you can add controls to almost every context menu with VBA code. The same restrictions for changing some context menus with VBA as in Excel 2007. Additionally, you can add buttons and menus to every context menu with RibbonX but if you want to disable or re-purpose controls, you may not be able to find the correct IDs (idMso).

    We are unable to customize the shape context menu in the Excel using command bar. I think it is same in PowerPoint and Word. In my opinion, it is the limitation of ribbon ui. You may submit a feedback on Office Dev User Voice site: https://officespdev.uservoice.com/

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Proposed as answer by Terry Xu - MSFT Monday, November 27, 2017 12:34 AM
    • Marked as answer by Andrei Smolin Thursday, November 30, 2017 7:50 AM
    Sunday, November 26, 2017 6:15 AM
    Moderator

All replies

  • Hello,

    We do not find any method to disable the button in the context menu of Shape when opening the file protected view windows. 

    In Customizing Context Menus in All Versions of Microsoft Excel

    • In Excel 2007, you can add controls to almost every context menu with VBA code. However, it is not possible to change some context menus such as the Shapes and Picture context menu with VBA. In addition, it is not possible to change context menus with RibbonX.
    • In Excel 2010, you can add controls to almost every context menu with VBA code. The same restrictions for changing some context menus with VBA as in Excel 2007. Additionally, you can add buttons and menus to every context menu with RibbonX but if you want to disable or re-purpose controls, you may not be able to find the correct IDs (idMso).

    We are unable to customize the shape context menu in the Excel using command bar. I think it is same in PowerPoint and Word. In my opinion, it is the limitation of ribbon ui. You may submit a feedback on Office Dev User Voice site: https://officespdev.uservoice.com/

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Proposed as answer by Terry Xu - MSFT Monday, November 27, 2017 12:34 AM
    • Marked as answer by Andrei Smolin Thursday, November 30, 2017 7:50 AM
    Sunday, November 26, 2017 6:15 AM
    Moderator
  • Thank you, Celeste.
    In my opinion, it is the limitation of ribbon ui.
    I also think so. It isn't described anywhere however.

    Regards from Belarus (GMT + 3),

    Andrei Smolin
    Add-in Express Team Leader

    Please mark answers and useful posts to help other developers use the forums efficiently.

    Thursday, November 30, 2017 7:50 AM