Foxtable(狐表)用户栏目专家坐堂 → [求助]如何找出文档包括的字符串


  共有5346人关注过本帖平板打印复制链接

主题:[求助]如何找出文档包括的字符串

帅哥哟,离线,有人找我吗?
大红袍
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/6/30 16:40:00 [只看该作者]

Dim app As New MSWord.Application
try
    Dim dlg As New FolderBrowserDialog
    If dlg.ShowDialog = DialogResult.Ok Then
        MessageBox.Show("需要检索的文档目录是:" & dlg.SelectedPath,"提示")
    End If
    Dim s As String = ""
    For Each file As String In FileSys.GetFiles(dlg.SelectedPath)
        If file.ToLower.EndsWith(".doc") Then
            Dim doc = app.Documents.Open(file)
            Dim gjz As String = Tables("说明书检索").Current("说明书关键字")
            If app.ActiveWindow.Selection.Find.Execute(gjz) = False  Then
                Doc.close
               
            Else
                s = s & IIF(s>"", chr(13), "") & file
            End If
        End If
    Next
    If s > "" Then
        MessageBox.Show("共计找到包含关键字的文档有" & s.Split(chr(13)).Length & "个,目录如下:" & vbcrlf & s,"关键字文档查找",MessageBoxButtons.OK,MessageBoxIcon.None)
    Else
        MessageBox.Show("没有找到包含关键字的文档","关键字文档查找",MessageBoxButtons.OK,MessageBoxIcon.None)
    End If
    app.Visible = True
catch ex As exception
    msgbox(ex.message)
    app.Quit
finally
End try

 回到顶部
总数 24 1 2 3 下一页