我使用的代码如下: 原意是从大量的Word中查找特定的字符,在查找过程出现闪烁,按上面所指方法后仍然有闪烁,请高手帮忙指点迷津呀!多谢多谢!!Public Sub OpenWord(view As Boolean) Set mywdapp = CreateObject("word.application") mywdapp.Visible = False mywdapp.ScreenUpdating = False If Err.Number <> 0 Then Exit Sub End If End SubPublic Function FindThis(C_TemplateDoc As String, FindStr As String) As Boolean Dim Td As New Word.Document If Len(FindStr) = 0 ThenExit Function End Ifmywdapp.Documents.Open(C_TemplateDoc) If Err.Number <> 0 Then FindThis = False Exit Function End IfSet mysel = mywdapp.Application.Selection mysel.Selectmysel.Find.ClearFormatting mysel.Find.Replacement.ClearFormatting With mysel.Find .Text = FindStr .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchByte = True .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With mysel.HomeKey Unit:=wdStory FindThis = mysel.Find.Execute mywdapp.Selection.Text = False mywdapp.Documents.Close End Function
mywdapp.Documents.Close 0 mywdapp.Quit Set mywdapp= Nothing 或 mywdapp.Documents.Close false mywdapp.Quit Set mywdapp= Nothing试一下,不确定行
然后操作。
原意是从大量的Word中查找特定的字符,在查找过程出现闪烁,按上面所指方法后仍然有闪烁,请高手帮忙指点迷津呀!多谢多谢!!Public Sub OpenWord(view As Boolean)
Set mywdapp = CreateObject("word.application")
mywdapp.Visible = False
mywdapp.ScreenUpdating = False
If Err.Number <> 0 Then
Exit Sub
End If
End SubPublic Function FindThis(C_TemplateDoc As String, FindStr As String) As Boolean
Dim Td As New Word.Document
If Len(FindStr) = 0 ThenExit Function
End Ifmywdapp.Documents.Open(C_TemplateDoc)
If Err.Number <> 0 Then
FindThis = False
Exit Function
End IfSet mysel = mywdapp.Application.Selection
mysel.Selectmysel.Find.ClearFormatting
mysel.Find.Replacement.ClearFormatting
With mysel.Find
.Text = FindStr
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
mysel.HomeKey Unit:=wdStory
FindThis = mysel.Find.Execute
mywdapp.Selection.Text = False
mywdapp.Documents.Close
End Function
mywdapp.Quit
Set mywdapp= Nothing
或 mywdapp.Documents.Close false
mywdapp.Quit
Set mywdapp= Nothing试一下,不确定行