Good morning all
can please advice me what is problem in the following code
this code for hide ribbon , tab , formula and full screen
the problem is ribbon is hide after open but when minimize workbook then maximize again its show ribbon and allow to goto visual basic code although this is protected with password
Private Sub Workbook_Open()
 Dim ws As Worksheet
For Each ws In Worksheets

          ws.Activate                                       ' this part to hide the list 
    Application.DisplayFullScreen = True
    Application.DisplayFormulaBar = False
    ActiveWindow.DisplayGridlines = False
    ActiveWindow.DisplayHeadings = False
    Application.DisplayStatusBar = False
    Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)"
     ActiveWindow.DisplayWorkbookTabs = False
                                             
                                     


    If ws.Name = "Sample ID test" Then                           ' this part to delete sample ID test sheet if present
        Application.DisplayAlerts = False
        Sheets("Sample ID test").Delete
        Application.DisplayAlerts = True
    End If


Sheets("Data Entry").ScrollArea = "A1:F97"                                 ' this part to prevent scroll area 




Sheets("Data Entry").Unprotect Password:="1234567"                ' this part to format range of cell but i enter unprotect line because its give me error if not used
Sheets("Data Entry").Select
Range("B2:B97").Select
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .Color = 16768648
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With
        Selection.Borders(xlDiagonalDown).LineStyle = xlNone
        Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .ThemeColor = 1
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .ThemeColor = 1
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .ThemeColor = 1
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .ThemeColor = 1
        .TintAndShade = 0
        .Weight = xlThin
    End With
        Selection.Borders(xlInsideVertical).LineStyle = xlNone
    With Selection.Borders(xlInsideHorizontal)
        .LineStyle = xlContinuous
        .ThemeColor = 1
        .TintAndShade = 0
        .Weight = xlThin
    End With

            
    With Sheets("Data Entry").Select          ' this part for clear content
        Range("A2,C2,D2").Select
        Selection.ClearContents
        Range("B2:B97").Select
        Selection.ClearContents
    End With
        
        
  ws.Range("B2:B97").Locked = False
    ws.Range("A2").Locked = False
    ws.Range("C2:D2").Locked = False
Sheets("Data Entry").Protect Password:="1234567"

Next

End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
    Dim ws As Worksheet
For Each ws In Worksheets
                      ws.Activate
    If ws.Name = "Sample ID test" Then
                    Application.DisplayAlerts = False
                    Sheets("Sample ID test").Delete
                    Application.DisplayAlerts = True
                End If
    
    Application.DisplayAlerts = False
        ThisWorkbook.Saved = True
    Application.DisplayAlerts = True
    Next
End Sub
all this code i put in thisworkbook