hide toolbar, ribbon, formula bar etc

Some videos you may like

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Yongle

Well-known Member
Joined
Mar 11, 2015
Messages
6,788
Office Version
  1. 365
Platform
  1. Windows
Here is one way
- hides when workbook opens, unhides the code when another window clicked on, hides when workbook re-activated, unhides when workbook is closed

Place your code to show and hide in HideToolbar_etc and then
- Hide with Workbook_Open and Workbook_WindowActivate
- Show with Workbook_BeforeClose and WindowDeactivate

Code:
Sub [I][COLOR=#006400]HideToolbar_etc[/COLOR][/I](T As Boolean)
    If T = True Then
       Code to  HIDE toolbar, formula bar, ribbon goes here
    Else
       Code to  SHOW toolbar, formula bar, ribbon goes here
    End If
End Sub

In ThisWorbook module
Code:
Private Sub Workbook_Open()
    HideToolbar_etc (True)
End Sub

Private Sub Workbook_WindowActivate(ByVal Wn As Window)
    HideToolbar_etc (True)
End Sub

Private Sub Workbook_WindowDeactivate(ByVal Wn As Window)
    HideToolbar_etc (False)
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
    HideToolbar_etc (False)
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,109,538
Messages
5,529,431
Members
409,876
Latest member
Akash Yadav
Top