none
Excel VB Script not Working in Office 2010 RRS feed

  • Question

  • What is problem with this command, it work fine in Windows 7 and Office 2007

    but

    not working in Office 2010 and Windows Server 2012

    VB syntax to hide view code on right click on worksheet

    Sub abc ()
    Application.CommandBars("ply").Controls("view code").Enabled = False

    End Sub


    Rox_Star


    Friday, April 26, 2019 4:15 AM

Answers

  • Found following answer on my other post and it is working.

    Please try this method and check if this will help you:

    Open Group Policy Editor- go to User Configuration- Administrative Templates- Microsoft Excel 2010- Disable Items in User Interface- Custom- select Disable commands:

    Enable the option and enter the ViewVisualBasicCode Policy ID: 1561

    Then you will not able to view Visual Basic code and disable all options and shortcut key to view code in Excel:

    Hope it's helpful.

    Regards, 


    Rox_Star

    • Marked as answer by rox_star Friday, May 3, 2019 6:41 AM
    Friday, May 3, 2019 6:41 AM

All replies

  • Hi Rox,

    Welcome to the Microsoft Office 2010 Planning, Deployment, and Compatibility forum. Your questions is mainly related to Excel VBA code. To help you better resolve the issue, I will move the thread to Excel for developers forum. You may get more helpful replies there.

    Thanks for your kind understanding.

    Best Regards,

    Herb


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Office 2019.

    Monday, April 29, 2019 3:06 AM
  • rox_star
    re: Ply menu

    The "Ply" menu is the worksheet tab menu not a worksheet menu.
    I would make sure that menu names have the correct case.
    Change .Enabled = True  to  .Enabled = False  to disable the menu item (gray it out).
    '---

    Custom_Functions add-in (19 new functions)
    Download for MediaFire
    ttp://www.mediafire.com/folder/lto3hbhyq0hcf/Documents


    Monday, April 29, 2019 12:38 PM
  • rox_star
    re: Ply menu

    The "Ply" menu is the worksheet tab menu not a worksheet menu.
    I would make sure that menu names have the correct case.
    Change .Enabled = True  to  .Enabled = False  to disable the menu item (gray it out).
    '---

    Custom_Functions add-in (19 new functions)
    Download for MediaFire
    ttp://www.mediafire.com/folder/lto3hbhyq0hcf/Documents


    Thx dear, I have done with Enabled = False but not working in Excel 2010. It works fine in Excel 2007. Can u tell the command/ syntax to disable in Office 2010.

    Regards


    Rox_Star

    Tuesday, April 30, 2019 5:05 AM
  • Rox_Star,

    You are right, trying to alter most/all items on the Ply menu in xl2010 can't be done.
    You can protect the code modules with a password in the Visual Basic Editor (VBE)
    Tuesday, April 30, 2019 2:50 PM
  • Found following answer on my other post and it is working.

    Please try this method and check if this will help you:

    Open Group Policy Editor- go to User Configuration- Administrative Templates- Microsoft Excel 2010- Disable Items in User Interface- Custom- select Disable commands:

    Enable the option and enter the ViewVisualBasicCode Policy ID: 1561

    Then you will not able to view Visual Basic code and disable all options and shortcut key to view code in Excel:

    Hope it's helpful.

    Regards, 


    Rox_Star

    • Marked as answer by rox_star Friday, May 3, 2019 6:41 AM
    Friday, May 3, 2019 6:41 AM