Macro to append text to end of paragraphs/lines where target text is found.
Hi,
I am trying to use this code:-
Sub Rpl()
Dim singleLine As Paragraph
Dim lineText As String
Dim MyPos
For Each singleLine In ActiveDocument.Paragraphs
lineText = singleLine.Range.Text
MyPos = InStr(lineText, "Test Text")
'If MyPos = 1 Then Replace(lineText , lineText & "LxW ")
If MyPos = 1 Then lineText = lineText & "LxW "
Next singleLine
End Sub
Although the value of 'lineText' gets updated, it doesn't replace it in the document, so I tried a VB6 'replace' function, which is invalid. How would I get the new value of lineText to replace the old value in the document?
Thanks
|