Sub test2()
Dim mFolder As String
Dim i As Integer
mFolder = ThisWorkbook.Path
With Application.FileSearch
.NewSearch
.LookIn = mFolder
.SearchSubFolders = False
.FileType = msoFileTypeExcelWorkbooks
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
If .FoundFiles(i) <> ThisWorkbook.FullName Then
Call Write_In(.FoundFiles(i))
End If
Next i
Else
MsgBox "文件夹 " & mFolder & "中没有所需的文件"
End If
End With
End Sub