![]() |
|
|||||||
|
|
Thread Tools | Display Modes |
|
#2
|
|||
|
|||
|
Try this. I prefer to use a for loop (rather than a for each loop) here.
Code:
Sub Rpl()
Dim lineText As String
Dim MyPos
Dim x As Integer
For x = 1 To ActiveDocument.Paragraphs.Count
lineText = ActiveDocument.Paragraphs(x).Range.Text
MyPos = InStr(lineText, "Test Text")
If MyPos = 1 Then
ActiveDocument.Paragraphs(x).Range.Text = lineText & "LxW "
End If
Next x
End Sub
|
| Tags |
| append, replace, vb6 |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Macro to hide all paragraphs that do not have the found result
|
jplat | Word VBA | 1 | 09-10-2017 09:13 PM |
| Delete Text from Insertion Point to Found Text | feenyman99 | Word | 0 | 04-17-2016 05:40 PM |
Macro to color row of Word table based on found text
|
kristib | Word VBA | 4 | 11-15-2015 02:42 PM |
Macro to Insert text into the beginning on specific paragraphs unless the paragraph is blank
|
caboy | Word VBA | 2 | 04-01-2015 07:00 AM |
| Macro to Insert Text Into Cells Having Multiple Lines | revans611 | Excel Programming | 4 | 10-24-2011 10:15 AM |