且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用VBA在文件系统中搜索文件路径

更新时间:2023-02-25 15:31:37

您可以使用 FindFirstFileEx 函数,以及 FINDEX_SEARCH_OPS 参数FindExSearchLimitToDirectories,它将搜索范围限制为与指定名称匹配并且还是目录的文件(如果文件系统支持目录过滤).有关从VB/VBA使用这些功能的更多信息,请参见以下内容:

You could use the FindFirstFile Win32 API, which allows you to search for files or sudirectories matching a specified name. Additionally, you could also use the FindFirstFileEx function, along with a FINDEX_SEARCH_OPS parameter of FindExSearchLimitToDirectories, which would limit your search to a file that matches a specified name and is also a directory (if the file system supports directory filtering). For more information on using these functions from VB/VBA see the following:

http://www.xtremevbtalk.com/showpost.php? p = 1157418& postcount = 4

http://support.microsoft.com/kb/185476

查看全文