打开指定路径下的Excel文件
打开指定路径下的Excel⽂件'⽤于批量处理Excel⽂件
Sub OpenXLSFile()
Dim Path$, File$
Dim wb As Workbook, sht As Worksheet
With Application.FileDialog(msoFileDialogFolderPicker)
If .Show Then打开excel很慢
Path = .SelectedItems(1)
File = Dir(Path & "\*.xls")
Application.EnableEvents = False
Application.Calculation = xlCalculationManual
Do Until LenB(File) = 0
Set wb = Workbooks.Open(Path & "\" & File)
For Each sht In wb.Worksheets
'加⼊需要处理的代码
Next
MsgBox wb.Name
wb.Close True
File = Dir
Loop
Application.EnableEvents = True
Application.Calculation = xlCalculationAutomatic
End If
End With
End Sub

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。