它的代码贯穿所有打开的工作簿,但有一个问题是它运行了大约 10 到 12 次然后停止。谁能给个思路...
Sub OpenAllWorkbooks()
Set destWB = ActiveWorkbook
Dim DestCell As Range
FileNames = Application.GetOpenFilename( _
filefilter:="Excel Files (*.csv*),*.csv*", _
Title:="Select the workbooks to load.", MultiSelect:=True)
If IsArray(FileNames) = False Then
If FileNames = False Then
Exit Sub
End If
End If
For n = LBound(FileNames) To UBound(FileNames)
Set wb = Workbooks.Open(Filename:=FileNames(n), ReadOnly:=True)
Next n
Dim cwb As Workbook
For Each cwb In Workbooks
'With Application
'cwb.AcceptAllChanges
'End With
Call donemovementReport
ActiveWorkbook.Close True
ActiveWorkbook.Close False
Next cwb
End Sub