Thanks Roy. I have added Workbook_Activate and Workbook_Deactivate codes to increase functionality. The new code is as follows:
Sheet1:
Option Explicit
Private Sub Worksheet_Activate()
TurnOff = False
Application.Run "DashboardOn"
End Sub
ThisWorkbook:
Option Explicit
Private Sub Workbook_Open()
Application.Run "DashboardOn"
TurnOff = False
End Sub
Private Sub Workbook_Activate()
Application.Run "DashboardOn"
TurnOff = False
End Sub
Private Sub Workbook_Deactivate()
Application.Run "DashboardOff"
TurnOff = True
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.Run "DashboardOff"
TurnOff = True
End Sub
Standard Module:
Option Explicit
Public TurnOff As Boolean
Private Sub DashboardOn()
With Application
.ScreenUpdating = False
If ActiveWorkbook.Name = ThisWorkbook.Name And _
ActiveSheet.Name = Sheets(1).Name Then ' Change sheet name to fit your needs
TurnOff = False
With ActiveWindow
.DisplayHeadings = False ' Remove Heading
.DisplayGridlines = False ' Remove Gridlines
.DisplayWorkbookTabs = False ' Remove Tabs
End With
.DisplayFullScreen = True ' Force fullscreen
.ExecuteExcel4Macro "Show.ToolBar(""Ribbon"", False)" ' Force the ribbon not to show
Else: Application.Run "DashboardOff" ' Another sheet is chosen so return everything to normal
End If
.ScreenUpdating = True
DoEvents
If TurnOff = False Then .OnTime Now() + TimeValue("00:00:03"), "DashboardOn"
End With
End Sub
Private Sub DashboardOff()
' Return items back on and restore screen to original size
TurnOff = True
With Application
.ScreenUpdating = False
.DisplayFullScreen = False
.ExecuteExcel4Macro "Show.ToolBar(""Ribbon"", True)"
End With
Windows(1).WindowState = xlMaximized
With ActiveWindow
.DisplayHeadings = True
.DisplayGridlines = True
.DisplayWorkbookTabs = True
End With
End Sub
Bookmarks