|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
选择文件删除- Sub ykcbf() '//2025.1.28 选择文件删除
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- Set fso = CreateObject("Scripting.FileSystemObject")
- p = ThisWorkbook.Path & ""
- On Error Resume Next
- Dim tm: tm = Timer
- With Application.FileDialog(msoFileDialogFilePicker)
- .Title = "请选择文件夹"
- .InitialFileName = ThisWorkbook.Path & ""
- .AllowMultiSelect = True
- .Filters.Clear
- .Filters.Add "Excel Files", "*.xls?"
- .Filters.Add "All Files", "*.*"
- If .Show Then Set fns = .SelectedItems Else Exit Sub
- End With
- For Each f In fns
- Set wb = Workbooks.Open(f, 0)
- For Each sht In wb.Sheets
- If InStr(sht.Name, "表样说明") Then sht.Delete
- Next
- wb.Close 1
- Next
- Application.ScreenUpdating = True
- Application.DisplayAlerts = True
- MsgBox "共用时:" & Format(Timer - tm, "0.00") & "秒!"
- End Sub
复制代码
|
|