简体   繁体   中英

C# VSTO Excel 2007 - disable hide/unhide button

I am working on a Excel VSTO 2007 application. I was wondering if there is a way I could disable the Hide and Unhide buttons present in Excel's View tab.

www.i.stack.imgur.com/vLfW5.png

edit: I am looking for a way to do it programatically using c# Code . The old vba might be useful. I have searched a lot and couldn't find any particular solution.

I use something like the below to disable the sheet deletion button, perhaps there's something similar for what you want:

Microsoft.Office.Tools.Excel.Worksheet.Worksheet excelShtBase;
excelShtBase.Application.CommandBars["Ply"].Controls["&Delete"].Enabled = false;

I don't think you can disable the built-in controls in Excel 2007 and onwards, unless you create your own ribbon bar controls with Ribbon XML.

There're lots of examples or tutorials on MSDN, and here's one for you ( Display and Hide Tabs, Groups, and Controls on the Microsoft Office Ribbon ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM