ทำให้ Dashboard ประทับใจแค่แว้บแรกที่เปิดดู
บนหน้าจอต้องทำให้ไม่เห็นว่านี่แหละ Excel
แนวคิดคือสร้าง 2 โหมด
- Present Mode = ซ่อนทุกอย่าง เหลือเฉพาะ Dashboard
- Design Mode = กลับสู่โหมดแก้ไขปกติ
VBA : Present Mode
Sub PresentMode()
Application.ScreenUpdating = False
‘ซ่อน Ribbon
Application.ExecuteExcel4Macro “SHOW.TOOLBAR(“”Ribbon””,False)”
‘ซ่อน Formula Bar
Application.DisplayFormulaBar = False
‘ซ่อน Status Bar
Application.DisplayStatusBar = False
‘ซ่อนหัวแถวหัวคอลัมน์
ActiveWindow.DisplayHeadings = False
‘ซ่อน Gridlines
ActiveWindow.DisplayGridlines = False
‘ซ่อน Scroll Bars
ActiveWindow.DisplayHorizontalScrollBar = False
ActiveWindow.DisplayVerticalScrollBar = False
‘ซ่อน Tabs
ActiveWindow.DisplayWorkbookTabs = False
‘ขยายเต็มจอ
Application.DisplayFullScreen = True
Application.ScreenUpdating = True
End Sub
VBA : Design Mode
ใช้กลับเข้าสู่โหมดทำงานปกติ
Sub DesignMode()
Application.ScreenUpdating = False
‘แสดง Ribbon
Application.ExecuteExcel4Macro “SHOW.TOOLBAR(“”Ribbon””,True)”
‘แสดง Formula Bar
Application.DisplayFormulaBar = True
‘แสดง Status Bar
Application.DisplayStatusBar = True
‘แสดงหัวแถวหัวคอลัมน์
ActiveWindow.DisplayHeadings = True
‘แสดง Gridlines
ActiveWindow.DisplayGridlines = True
‘แสดง Scroll Bars
ActiveWindow.DisplayHorizontalScrollBar = True
ActiveWindow.DisplayVerticalScrollBar = True
‘แสดง Sheet Tabs
ActiveWindow.DisplayWorkbookTabs = True
‘ออกจาก Full Screen
Application.DisplayFullScreen = False
Application.ScreenUpdating = True
End Sub
ซ่อนทุก Sheet เหลือเฉพาะ Dashboard
เหมาะกับตอน Present ให้ผู้บริหารดู
Sub DashboardOnly()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
If ws.Name <> “Dashboard” Then
ws.Visible = xlSheetVeryHidden
End If
Next ws
Sheets(“Dashboard”).Activate
End Sub
คืนค่าทุก Sheet
Sub ShowAllSheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Visible = xlSheetVisible
Next ws
End Sub
One Click Present Mode
กดปุ่มเดียวแล้วเข้าสู่โหมดนำเสนอทันที
Sub StartPresentation()
Call DashboardOnly
Call PresentMode
Sheets(“Dashboard”).Activate
Range(“A1”).Select
End Sub
One Click Design Mode
กลับมาแก้ไขงาน
Sub BackToDesign()
Call DesignMode
Call ShowAllSheets
End Sub
เพิ่มความ Professional อีกระดับ
ถ้าต้องการให้ดูเหมือนแอป Dashboard จริง ๆ สามารถเพิ่ม
ActiveWindow.Zoom = 90
หรือ
ActiveWindow.Zoom = True
เพื่อให้ Excel ซูมพอดีกับหน้าจออัตโนมัติ
รวมกับการ Protect Dashboard
Sheets(“Dashboard”).Protect _
Password:=”1234″, _
UserInterfaceOnly:=True
จะทำให้ผู้บริหารเห็นเฉพาะ Dashboard และคลิกแก้ไขสูตรหรือกราฟไม่ได้ แต่ VBA ยังทำงานได้ตามปกติ
🎯 ผลลัพธ์ที่ได้ใกล้เคียงภาพตัวอย่างมาก คือเปิดไฟล์แล้วกด StartPresentation จะเหลือเฉพาะ Dashboard เต็มจอ สะอาด ไม่มี Ribbon, Formula Bar, Gridlines, Tabs หรือ Sheet อื่นมารบกวนสายตา