在所有文档中搜索字符串? [英] Search all documents for a string?

查看:98
本文介绍了在所有文档中搜索字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我正在尝试使用以下脚本来搜索所有类型的文档而不仅仅是txt。特别是单词和excel。这是一个简单的解决方案吗?



Hi all,

I'm trying to use the following script to search all types of documents not just txt. Specifically word and excel. Is this an easy fix?

dim filesys
set filesys=CreateObject("Scripting.FileSystemObject")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim objShell
set objShell = CreateObject("WScript.Shell")

x=msgbox("Word Search Started",0,"Word Check")

strSearchFor = "word"
Set oFSO = CreateObject("Scripting.FileSystemObject")
objStartFolder = "C:\Test1\"
 
Set objFolder = objFSO.GetFolder(objStartFolder)
 
Set colFiles = objFolder.Files
For Each objFile in colFiles
    strFile = "C:\Test1\" & objFile.Name
    set objFile = objFSO.getFile(strFile)
    if objFile.size > 0 then
        If InStr(oFSO.OpenTextFile(strFile).ReadAll, strSearchFor) > 0 Then
	    x=msgbox("Word Found!",16,"Word Check")
        Else
	    x=msgbox("No Word Found",0,"Word Check")
            WScript.Sleep (100)
        END If
    END If
Next

推荐答案

请尝试使用我的文章: hOOt - 全文搜索引擎 [ ^ ]
Try using my article instead : hOOt - full text search engine[^]


这篇关于在所有文档中搜索字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆