用密码把文件工作表的保护改了  然后保存   再打开又有保护了
里面写了类似这样的代码
应该取消掉哪些 非常感谢
Private Sub Workbook_Open()
    Application.ScreenUpdating = False
    Application.Visible = False
    DisplaySetting
    LockSheetArea Sheet5, "A1:J20"
    LockSheetArea Sheet6, "A1:J20"
    Application.Cursor = xlDefault    
    ActiveWindow.Caption = ""
    Application.CommandBars("Toolbar list").Enabled = True '屏蔽右键工具栏
    Application.CommandBars("Standard").Visible = False
    Application.CommandBars("Formatting").Visible = False
    Application.DisplayFormulaBar = False
    Application.DisplayStatusBar = True
    ActiveWindow.DisplayWorkbookTabs = True   '隐藏工作表标签
    MyBar_Menu
    MyTool
     Application.ScreenUpdating = True
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
    Application.Caption = "Microsoft Excel"
    Application.StatusBar = ""
    MyBarDelete
    ShowBar
    Application.CommandBars("库存管理系统工具栏").Delete
    With Sheets("Protect")
         .Unprotect Password:="G_YX"
         .Range("Q1") = .Range("Q1") + 1
         .Protect Password:="G_YX"
         .Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
         .EnableSelection = xlNoSelection
         ActiveWorkbook.Unprotect Password:="770114"
         .Visible = True
         .Activate
    End With
    For J = 1 To Sheets.Count
         If Sheets(J).Name <> "Protect" Then
              Sheets(J).Visible = False
         End If
    Next J
    ActiveWorkbook.Protect Password:="770114"
    Me.save
End Sub还有
With Sheets("材料")
         .Unprotect Password:="G_YX"

解决方案 »

  1.   

       With Sheets("Protect") 
            .Unprotect Password:="G_YX" 
            .Range("Q1") = .Range("Q1") + 1 
            .Protect Password:="G_YX" 
            .Protect DrawingObjects:=True, Contents:=True, Scenarios:=True 
            .EnableSelection = xlNoSelection 
            ActiveWorkbook.Unprotect Password:="770114" 
            .Visible = True 
            .Activate 
        End With 
        For J = 1 To Sheets.Count 
            If Sheets(J).Name <> "Protect" Then 
                  Sheets(J).Visible = False 
            End If 
        Next J 
        ActiveWorkbook.Protect Password:="770114" 都不要
      

  2.   

    谢谢
      还是不行   Public Sub ProtectSheet(sht As Worksheet, strPassword As String)
        sht.Protect Password:=strPassword
    End SubPublic Sub UnprotectSheet(sht As Worksheet, strPassword As String)
        sht.Unprotect Password:=strPassword
    End Sub这个要不要去掉
      

  3.   

    Sub 主界面()
        Sheets("主界面").Activate
        ActiveWindow.ScrollColumn = 3
        LockSheetArea Sheet2, "D1"
        For J = 1 To Sheets.Count
             If Sheets(J).Name <> "主界面" Then
                  Sheets(J).Protect Password:="G_YX"
                  Sheets(J).Visible = False
             End If
        Next J
    End Sub
      

  4.   

     .Protect Password:="G_YX"
                  .Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
                  .EnableSelection = xlNoSelection
    这个要不要