wbPassword = clsMF.GetPassWord("admin") End If wb.Unprotect (wbPassword) End If Call BackTo Set ws = ThisWorkbook.Sheets("用户权限表") With ws lastRow = .UsedRange.Rows.Count arrUser = .Range("A2:D" & lastRow).Value End With End Sub Private Sub CmdLogin_Click() On Error Resume ...
1.新增、打开、关闭工作簿 Workbooks.Add '新增工作簿 Workbooks.Open("E:\VBAMatrix.xlsx") '打开工作簿 Workbooks.Close '关闭所有打开的工作簿 2.保护/取消保护工作簿 ActiveWorkbook.Protect Password:="123456" '保护工作簿 ActiveWorkbook.Unprotect "123456" '取消当前工作簿的保护 3.激活工作簿 Workbooks("V...
Example 1: Protect your Sheet with All Default options Function ProtectSheet_Default() 'To protect the Sheet1 without any password with all default parameters Worksheets("Sheet1").Protect End Function Example 2: Protect your Sheet with a password Function ProtectSheet_Password() 'To protect the ...
`复制一张新表Sheet4.Copyafter:=Sheets(Sheets.Count) 属性 Sheets.Count `表的数量 Sheet1.Name ="1月"`表的名称 Sheet1.Visible = xlSheetVeryHidden'只有改变为true才可见Sheet1.Visible = xlSheetVisible'值为-1,使可见Sheet2.Protect"test"'保护Sheet2.Unprotect Password:="test"'取消保护 操作单元格 ...
"Enter Multiple Sheets") Sheets.Add After:=ActiveSheet, Count:=i End Sub 如果要在单个镜头中在工作簿中添加多个工作表,则可以使用此代码。运行此宏代码时,您将获得一个输入框,用于输入要输入的工作表总数。 40. 保护工作表 Sub ProtectWS() ActiveSheet.Protect "mypassword", True, True ...
WithActiveWorkbook WinTag = .ProtectStructureOr.ProtectWindows EndWith ShTag =False ForEachw1InWorksheets ShTag = ShTagOrw1.ProtectContents Nextw1 IfNotShTagAndNotWinTagThen MsgBoxMSGNOPWORDS1, vbInformation, HEADER Exit Sub EndIf MsgBoxMSGTAKETIME, vbInformation, HEADER ...
ActiveSheet.Protect "123", True, True End Sub 如果要保护工作表,可以使用此宏代码。您所要做的就是在代码中提及您的密码。If you want to protect your worksheet you can use this macro code. All you have to do just mention your password in the code.本节内容参考程序文件:Chapter04.xlsm 7 ...
254 [示例04-14-03]保护当前工作簿中的所有工作表 255 Sub ProtectAllWorkSheets() 256 On Error Resume Next 257 Dim ws As Worksheet 258 Dim myPassword As String 259 myPassword = InputBox("请输入您的密码" & vbCrLf & _ 260 "(不输入表明无密码)" & vbCrLf & vbCrLf & _ 261 "确保您没有...
Const VERSION As String = DBLSPACE & "Version 1.1.1 2003-Apr-04"Const REPBACK As String = DBLSPACE & "Please report failure " & _"to the microsoft.public.excel.programming newsgroup."Const ALLCLEAR As String = DBLSPACE & "The workbook should " & _"now be free of all password ...
17、ach w1 In W 602021/3/11 orksheetsWith w1If .ProtectContents ThenOn Error Resume NextDo Dummy 612021/3/11 do loopFor i=65 To 66: For j=65 To 66: For k=65 To 66For l=65 To 66: F 622021/3/11 or m=65 To 66: For i1=65 To 66For i2=65 To 66: For i3=65 To 66...