T
Tony
I have to perform the following action it the text data files. I have to find
the pattern, if found check if the word on the beginning of the paragraph is
ENTRY, if yes move 1 paragraph down and insert new paragraph with some text.
I have difficulties with repeating of the searches to the end of the file. I
am trying the following code but it is not doing what I need:
Sub Test()
SearchFor = "7322712"
PlaceNo = "123123123"
With ActiveDocument.Content.Find
Do While .Execute(FindText:=SearchFor, Forward:=True, _
Format:=False) = True
Selection.MoveLeft Unit:=wdWord, Count:=4
Selection.MoveLeft Unit:=wdWord, Count:=1, Extend:=wdExtend
If Selection.Text = "ENTRY" Then
Selection.MoveDown Unit:=wdParagraph, Count:=1
Selection.TypeText Text:="FIELD,Marker," & PlaceNo
Selection.TypeParagraph
End If
Loop
End With
End Sub
Can someone help me and corret my code. Thank you.
Tony
the pattern, if found check if the word on the beginning of the paragraph is
ENTRY, if yes move 1 paragraph down and insert new paragraph with some text.
I have difficulties with repeating of the searches to the end of the file. I
am trying the following code but it is not doing what I need:
Sub Test()
SearchFor = "7322712"
PlaceNo = "123123123"
With ActiveDocument.Content.Find
Do While .Execute(FindText:=SearchFor, Forward:=True, _
Format:=False) = True
Selection.MoveLeft Unit:=wdWord, Count:=4
Selection.MoveLeft Unit:=wdWord, Count:=1, Extend:=wdExtend
If Selection.Text = "ENTRY" Then
Selection.MoveDown Unit:=wdParagraph, Count:=1
Selection.TypeText Text:="FIELD,Marker," & PlaceNo
Selection.TypeParagraph
End If
Loop
End With
End Sub
Can someone help me and corret my code. Thank you.
Tony