![]() |
|
|||||||
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
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 |
| 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 |