引用word对象,然后参照word宏的代码用VBA查找。

解决方案 »

  1.   

    不用word对象,有跟好的方法吗?
      

  2.   

    首先你要知道doc的格式,如果是纯文本的话,那是很简单,用sPos = InStr(1, FindString, "abc", vbTextCompare);
      

  3.   

    引用 Word 对像'===============================================================================
    Option ExplicitPrivate Sub Form_Load()
    Dim a As New Word.Application
    Dim d As New Word.Document
    Set d = a.Documents.Open("D:\我的文档\饮酒者比滴酒不沾者活得更长.doc")
    If InStr(d.Content, "袁飞") Then
        MsgBox "这篇文章包含“袁飞”二字!"
    End If
    d.Close
    Set d = Nothing
    Set a = Nothing
    End Sub