View Single Post
  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Steved
 
Posts: n/a
Default What is required to find two words please

Hello Graham from Steved

Thankyou

"Graham Mayor" wrote:

You can find the hyphenated words, but random phrases are impossible to
find - unless they are all known beforehand and you use an array eg.

Sub ReplaceList()
Dim vFindText As Variant
Dim vReplText As Variant
Dim i As Long
vFindText = Array("DCASH-SKAI GLORY", "GOLD BROSE-MOLINEUX", _
"WOODBURY LAD-FASHION COURT", "VOLKSRAAD-WALKIN ON SUNSH")
vReplText = Array("WORD1", "WORD2", "WORD3", "WORD4")
With Selection.Find
.Forward = True
.Wrap = wdFindContinue
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Format = True
.MatchCase = True
For i = LBound(vFindText) To UBound(vFindText)
.Text = vFindText(i)
.Replacement.Text = vReplText(i)
.Execute replace:=wdReplaceAll
Next i
End With
End Sub

Steved wrote:
[A-Za-z]@-[A-Za-z]@ will find CULLEN-SONET

What is required to find the below examples please.
DCASH-SKAI GLORY
GOLD BROSE-MOLINEUX
WOODBURY LAD-FASHION COURT
VOLKSRAAD-WALKIN ON SUNSH

Thankyou