保持Excel始终处于全屏模式

时间:2015-02-11 13:08:08

标签: excel-vba vba excel

我使用以下代码使Excel在启动时看起来像“应用程序”或网页,以使其全屏显示:

With ActiveWindow
.DisplayHorizontalScrollBar = False
.DisplayVerticalScrollBar = False
.DisplayHeadings = False
End With

Application.CommandBars.ActiveMenuBar.Enabled = False
Application.DisplayFullScreen = True
Application.CommandBars("Full Screen").Enabled = False

有一种方法可以阻止excel返回“正常”模式吗?由于按下“esc”键就可以了。

2 个答案:

答案 0 :(得分:1)

这有用吗:

' Disable the Esc key.
Private Sub Workbook_Open()
   Application.OnKey "{ESC}", ""
End Sub

' Return the Esc key to normal.
Private Sub Workbook_BeforeClose(Cancel As Boolean)
   Application.OnKey "{ESC}"
End Sub

将上述内容放在VBA编辑器的“ThisWorkbook”部分中。

答案 1 :(得分:0)

禁用Esc键。

Private Sub Workbook_Open()
   Application.OnKey "{ESC}", ""
End Sub

将Esc键恢复正常。

Private Sub Workbook_BeforeClose(Cancel As Boolean)
   Application.OnKey "{ESC}"
End Sub

当您最小化窗口时,图标会重新出现。你还需要禁用最小化窗口。