|
- Sub test()
- Dim arr, i As Integer, wb As Workbook
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- arr = Application.GetOpenFilename("excel文件,*.xls*", "请选择加密文件(可多选)", MultiSelect:=True)
- If VBA.IsArray(arr) = True Then
- For i = 1 To UBound(arr)
- Set wb = Workbooks.Open(arr(i))
- With wb.Worksheets("目录")
- .Range("i1").Value = "我爱vba"
- .Protect ("123456")
- End With
- wb.Save
- wb.Close
- Next i
- End If
- Application.ScreenUpdating = True
- Application.DisplayAlerts = True
- End Sub
复制代码 |
|