startFromScratch正在删除工作簿的关闭(x)按钮

时间:2014-10-08 17:47:41

标签: excel vba excel-vba ribbon

对于Excel,我使用属性startFromScratch =“True”来删除功能区选项卡,但它也删除了工作簿的关闭按钮(参见图片)。有没有办法不删除它?我知道你可以使用startFromScratch,你可以单独通过VBA显示你想要的标签,如本网站所述:http://www.msofficegurus.com/post/Customizing-the-Ribbon-startFromScratch-and-Tab-visibility.aspx

现在,是否可以再次添加关闭按钮?我相信可能会有类似的代码通过VBA显示它。

Before and after startFromScratch

1 个答案:

答案 0 :(得分:0)

这是我使用的代码:

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="true">
<qat>
 <documentControls>
<control 
   idMso="FileSaveAs"
   screentip="SAVE AS..."
   supertip="Click here to save this file to another location."/>
<control 
   idMso="WindowSwitchWindowsMenuExcel"
   screentip="SWITCH EXCEL FILE"
   supertip="Click here to switch from this workbook to another open excel file."/>
<control 
   idMso="FilePrint"
   screentip="PRINT FILE"
   supertip="Click here to enable the print menu."/>
 </documentControls>
 </qat>
 </ribbon>
</customUI>

修改

在我使用的Excel版本中,以下xml不会隐藏这些按钮:

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
  <ribbon startFromScratch="true"></ribbon>
</customUI>