我有一个excel仪表板,其工作原理是在excel文件关闭之前,我想显示所有EXCEL功能区,以便下次打开excel时,application / excel将显示功能区 . 目前,如果打开excel,它不显示功能区 .
Private Sub Workbook_BeforeClose(cancel As Boolean)
On Error Resume Next
Application.ScreenUpdating = True
ActiveWindow.DisplayWorkbookTabs = True
Application.DisplayFormulaBar = True
Application.DisplayFullScreen = False
Application.DisplayStatusBar = True
Application.DisplayScrollBars = True
Application.ScreenUpdating = True
Sheets("Introduction").Select
End Sub
This is an .xls file with Macro and supposed to work in Excel 2003 and Excel 2007.
此外,如果单击“取消”,我不想显示任何上述/功能区,因为用户应该获得excel仪表板的受保护视图 .
2 回答
如果功能区默认关闭,则可以通过双击其中一个选项卡(例如,“主页”选项卡)再次打开它 .
(有关详细信息,请参阅this) .
但是,如果您希望在工作簿打开时编写事件,请使用
ThisWorkbook
Excel对象中的Workbook_Open()
事件 .试试这个Application.ExecuteExcel4Macro“show.toolbar(”“Ribbon”“,true)”隐藏Application.ExecuteExcel4Macro“show.toolbar(”“Ribbon”“,false)”