View Single Post
 
Old 02-13-2019, 03:55 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,158
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Try
Code:
Sub FindWords2()
  Dim aRng As Range, sResponse As String
  sResponse = "<32P[0-9]{1,}"
  Set aRng = ActiveDocument.Range
  If sResponse <> "" Then
    With aRng.Find
      .ClearFormatting
      .Text = sResponse
      .MatchWildcards = True
      Do While .Execute  ' Loop until Word can no longer find the search string
        MsgBox aRng.Text
      Loop
    End With
    Application.ScreenUpdating = True
  End If
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote