您的位置:首页 > 编程语言 > VB

【VBA】通过VBA实现EXCEL真正的全屏显示

2019-04-13 10:40 537 查看
版权声明:转载或使用本博客原创文章,请标明出处并附上链接,谢谢。 https://blog.csdn.net/WangPaiFeiXingYuan/article/details/89278812

说明:通过VBA实现真正的全屏显示excel界面。

测试代码:

[code]Private Sub CommandButton1_Click()
If CommandButton1.Caption = "全屏显示" Then
With Application
.DisplayFullScreen = True  '基本全屏
.CommandBars(1).Enabled = False  '隐藏工作表菜单栏
.CommandBars("Full Screen").Controls(1).OnAction = "Restorewindow"
End With
With ActiveWindow
.DisplayHeadings = False  '隐藏行号列号
.DisplayHorizontalScrollBar = False '隐藏滚动条
.DisplayVerticalScrollBar = False '隐藏滚动条
Rem .DisplayWorkbookTabs = False   '隐藏工作表标签
End With
CommandButton1.Caption = "取消全屏"
Else
With Application
.DisplayFullScreen = False
.CommandBars(1).Enabled = True
.CommandBars("Full Screen").Reset
End With
With ActiveWindow
.DisplayHeadings = True
.DisplayHorizontalScrollBar = True
.DisplayVerticalScrollBar = True
Rem .DisplayWorkbookTabs = True
End With
CommandButton1.Caption = "全屏显示"
End If
End Sub

效果演示:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: