Remove Ribbon from Excel

纵然是瞬间 提交于 2019-12-24 01:04:35

问题


I'm trying to remove the ribbon bar from the Excel window. Currently I'm using the following code which removes the ribbon.

excelApp.ExecuteExcel4Macro("SHOW.TOOLBAR(""Ribbon"",False)") 

But it also removes everything above the cells including the title bar. I need the title bar so users can move, minimize, maximize and close the window. Ideally I would like to remove the entire ribbon but I would be satisfied if I could minimize the Icons on the Ribbon. I can minimize the ribbon icons by clicking the small black rectangle and triangle icon on the title bar so it must be possible.


回答1:


Never found a good workaround, except this clever solution in VBA that you should be able to recreate in .net.

Sub HideRibbon()

Application.SendKeys ("^{F1}")

End Sub

Ctrl+F1 is the combination to minimize the ribbon and maximize it, so you can use this as a toggle button if you really wish. You could set this up to run at workbook open if you like using simple VBA.



来源:https://stackoverflow.com/questions/13735595/remove-ribbon-from-excel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!