直接上代码了。


 1 sub fileFind()
 2   'filepath to be found
 3   folder="D:/PathofFindFile"
 4   'sheet name to be found
 5   findSheetName="FindSheetName"
 6   With Application.FileSearch
 7     .NewSearch
 8     .LookIn=folder
 9     .FileType=msoFileTypeExcelWorkbooks
10     If .Execute>1 Then
11       For i=1 to .FoundFiles.Count
12       'open the excel file
13       Set eachBook=Workbooks.Open(.FoundFiles(i))
14         For j=1 To eachBook.Worksheets.Count
15           If UCase(eachBook.Worksheets(j).Name)=findSheetName
16           'process after being found
17           End If
18         Next j
19       eachBook.Close
20       Next i
21     End If
22   End With    
23 End sub
24 


  

相关文章:

  • 2021-12-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-19
  • 2022-01-06
  • 2021-12-13
  • 2022-12-23
猜你喜欢
  • 2022-01-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-12
  • 2021-10-25
相关资源
相似解决方案