![]() |
|
|||||||
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
I have the following code that removes instances of the word 'means' that follow after the bold definition text. However, the macro also removes any additional word 'means' that may be within the same paragraph as normal text. What can I add to the code that would stop this from happening. Thanks
Remove the word means TEST DOC June 2021.docx Code:
Sub DefMeans()
Dim aRng As Range, aPara As Paragraph
Set aRng = ActiveDocument.Range
For Each aPara In aRng.Paragraphs
Next aPara
With aRng.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "[:;, ^t]{1,5}means[:;, ]{1,5}"
.Replacement.Text = "^t"
.MatchWildcards = True
.Execute Replace:=wdReplaceAll
End With
End Sub
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Replace a character only if it is at the beginning of the paragraph.
|
donpopo | Word | 2 | 11-11-2018 11:32 PM |
Word macro to insert text at the beginning of paragraph but skip tables
|
ashalles135 | Word VBA | 5 | 09-26-2018 09:49 AM |
Space tab at the beginning of each paragraph in a chapter
|
village | Word | 3 | 07-20-2018 01:48 AM |
word macro To insert text at the beginning and at end of paragraph
|
ArieH | Word VBA | 20 | 09-10-2017 04:23 PM |
remove row from dataset for additional calculations
|
canajun | Excel | 1 | 01-06-2015 06:38 AM |