Hi,
The script I have currently searches for two words but I would like it to search for five words.
The other three words I would like to search are "Audio-^#^#^#^#^#", "Photo-^#^#^#^#^#" and "Video-^#^#^#^#^#"
The script below will find two words and works but how can I amend it other than running it two more times to include the additional 3 search terms?
Sub FindSourceDocs1()
Dim FoundResult As Boolean
Dim pageserial, SearchSeq, SearchSingle As String
Dim PgColour As WdColor
Dim CurrentDoc As String
Dim FndText As String
Application.ScreenUpdating = False
CurrentDoc = ActiveDocument.Name
FoundResult = True
SearchSeq = "Doc-^#^#^#^#^#"
SearchSingle = "Task-^#^#^#^#^#"
PgColour = wdColorRed 'RED
Do Until FoundResult = False
Selection.Find.ClearFormatting
Selection.Find.Font.Color = PgColour
Selection.Find.Text = SearchSeq
Selection.Find.Wrap = wdFindContinue
If Selection.Find.Execute = True Then
pageserial = LTrim(Selection)
Documents("SourceDoc.docx").Activate
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Text = pageserial
If Selection.Find.Execute = True Then
Selection.Rows(1).Select
Selection.Copy
Documents(CurrentDoc).Activate
Selection.Find.Text = pageserial
With Selection.Find
Selection.Paste
End With
Else
Selection.HomeKey Unit:=wdStory
Windows(CurrentDoc).Activate
If PgColour = wdColorGreen Then Selection.Font.Color = wdColorRed Else: Selection.Font.Color = wdColorGreen
End If
Else
If FoundResult = True And SearchSeq = "Doc-^#^#^#^#^#" Then
SearchSeq = SearchSingle
FoundResult = True
Else
FoundResult = False
End If
End If
Loop
Application.ScreenUpdating = True
End Sub