文件内容快速查找工具(快速搜索电脑文件的软件)
运行过程演示
任务内容:
有个质保书文件库,经常要从里面查找各个工程对应要用到的质保书文件。
任务难点:文件库里面文件多年积累已经达到一万多个文件,各项目的所用的质保书都不一样并且数量也不少从几十张到几百张都有,人工查找文件一天下来手基本要残废了。
解决方案:
1.列出要查找的文件名
2.直接从文件库复制到指定文件夹
3.在列表标记已经找的文件
上代码:
'=============循环复制文件到指定位置=========== For rng = 2 To endL '工作表要查找的文件列表循环 fileName = mSheet.Cells(rng, Index) souf = sourPath & fileName & ".pdf" desf = savePath & fileName & ".pdf" FileCopy souf, desf If IsFileExists(desf) = True Then '判断文件是否纯在 mSheet.Cells(rng, Index).Interior.Color = 98535 Else souf = sourPath & fileName & ".jpg" desf = savePath & fileName & ".jpg" FileCopy souf, desf If IsFileExists(desf) = True Then mSheet.Cells(rng, Index).Interior.Color = 98535 Else souf = sourPath & fileName & ".png" desf = savePath & fileName & ".png" FileCopy souf, desf If IsFileExists(desf) = True Then mSheet.Cells(rng, Index).Interior.Color = 98535 End If End If End If Next
'=============判断文件是否存在=========== Function IsFileExists(ByVal strFileName As String) As Boolean If Dir(strFileName, 16) <> Empty Then IsFileExists = True Else IsFileExists = False End If End Function
由于文件库存储的文件有三种格式(pdf,png,Jpg),查找的文件一般是这几种格式中的一种,所以这里做了判断,要是有其它格式也可以自己自行添加。
工具虽然很简单,但对于那些经常要查找很多文件的人可以说是救命工具了。
要是对你有帮助,别忘了点赞收藏加关注。
作者介绍:专注办公自动化,让工作轻松起来
赞 (0)