查找某个文件夹下,是否存在某个文件。

Sub dfads()

For Each file In fso.GetFolder(ThisWorkbook.path).Files
    If InStr(file.Name, "xiyouji") Then
        Debug.Print file.Name
        Exit For
    End If
    
Next

End Sub

  查找某个文件夹下,是否存在某个文件。

利用for循环遍历文件;

然后利用instr函数;

找到后就退出for循环。

posted @ 2022-04-29 01:07  uuxyz  阅读(103)  评论(0)    收藏  举报
联系我