RobiNew, what do you mean by "extract": hilighting, msgboxing, adding to a collection, deleting...? For me your task is not quite clear.
If you need to hilight the found strings, you may use the followng code, which was once made by gmaxey and slightly modified by me:
Sub Hilite_Array_T()
'In selection, hilite all instances of 'width=' and 'height=' followed
'by three-digit numbers.
Application.ScreenUpdating = False
Dim vFindTxt As Variant
Dim oRng As range
Dim i As Long
vFindTxt = Array("width=", "height=")
For i = 0 To UBound(vFindTxt)
Set oRng = selection.range
With oRng.Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(FindText:=vFindTxt(i), _
MatchWholeWord:=True, _
Forward:=True, _
Wrap:=wdFindStop) = True And _
oRng.End <= selection.range.End
oRng.MoveEnd unit:=wdCharacter, count:=3
oRng.HighlightColorIndex = wdYellow
oRng.Collapse wdCollapseEnd
Loop
End With
DoEvents
Next
lbl_Exit:
Set oRng = Nothing
Exit Sub
Application.ScreenUpdating = True
End Sub
|