O
Oozle_Finch
Hello,
I am trying to efficiently/quickly(in terms of CPU usage and time) find a
pattern of text within a Word document. Basically, 3 digits followed by a
dash, and then 4 more digits. I am wondering if the below code is appropriate?
Application.Selection.HomeKey( _
Word.WdUnits.wdStory, Word.WdMovementType.wdMove)
Dim strFind As String = ([0-9]{3})-([0-9]{4})
Dim fnd As Word.Find = Application.Selection.Find
fnd.ClearFormatting()
fnd.Text = strFind
If fnd.Execute() Then
MessageBox.Show("Text found.")
Else
MessageBox.Show("Text not found.")
End If
Thanks for any help
Jeremy
I am trying to efficiently/quickly(in terms of CPU usage and time) find a
pattern of text within a Word document. Basically, 3 digits followed by a
dash, and then 4 more digits. I am wondering if the below code is appropriate?
Application.Selection.HomeKey( _
Word.WdUnits.wdStory, Word.WdMovementType.wdMove)
Dim strFind As String = ([0-9]{3})-([0-9]{4})
Dim fnd As Word.Find = Application.Selection.Find
fnd.ClearFormatting()
fnd.Text = strFind
If fnd.Execute() Then
MessageBox.Show("Text found.")
Else
MessageBox.Show("Text not found.")
End If
Thanks for any help
Jeremy