M
Minerva
I have a large Word XP doc that is being built by a VB.Net
project. Content is inserted into the document and then a
Find/Replace is done to replace certain terms.
Because of the length of the document, the Find/Replace
routine is taking a significant amount of time. Can I set
the Find/Replace routine to only look at the last two
pages of the document (I know the inserted text will
always be one or two pages but no longer). Right now I am
starting at the beginning of the doc and searching through
the entire thing. I dont know if I can start the find at
the end of the document and/or search only a specified
number of pages but the way I have it set up now, the
process is taking up to a half hour for documents that end
up being 200 pages or so.
With oDoc.Range.Find
.ClearFormatting()
.Forward = True
Try
Dim objTagName As Object = tagName
Dim objReplaceString As Object = replaceString
.Execute(FindText:=objTagName, _
ReplaceWith:=objReplaceString, _
Replace:=2) '2 = wdReplaceAll)
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
End With
project. Content is inserted into the document and then a
Find/Replace is done to replace certain terms.
Because of the length of the document, the Find/Replace
routine is taking a significant amount of time. Can I set
the Find/Replace routine to only look at the last two
pages of the document (I know the inserted text will
always be one or two pages but no longer). Right now I am
starting at the beginning of the doc and searching through
the entire thing. I dont know if I can start the find at
the end of the document and/or search only a specified
number of pages but the way I have it set up now, the
process is taking up to a half hour for documents that end
up being 200 pages or so.
With oDoc.Range.Find
.ClearFormatting()
.Forward = True
Try
Dim objTagName As Object = tagName
Dim objReplaceString As Object = replaceString
.Execute(FindText:=objTagName, _
ReplaceWith:=objReplaceString, _
Replace:=2) '2 = wdReplaceAll)
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
End With