![]() |
|
#3
|
|||
|
|||
|
Hello East,
I can’t thank you enough. I had been trying to work out the wildcard combinations for quite a while, without success. I had worked out breaking the parts within brackets and had the first part (No restrictions apply), but the second part where it may or may not have an existing full stop/period had me stumped. Not being that familiar with the use of wildcard characters was where I was stuck and I must admit I did not fully understand the use of the exclamation character ([!.]). After struggling with the wildcards option, I then thought I would try another approach and find the specific word/s in a paragraph and delete the entire paragraph and replace it with what I was after. That way if the line contained a full stop/period on not it would delete the entire line and replace it with what I was after. I found a reply by Greg Maxey to another post and edited this to suit my needs (link in code). Code:
Sub Add_Full_Stop_After_apply()
'https://www.msofficeforums.com/word-vba/45779-how-i-add-missing-stop-period-end.html
Dim oRng As Range
Set oRng = ActiveDocument.Range
With oRng.Find
'.Text = "[!.\!\?]" & Chr(13)
.Text = "[apply]" & Chr(13)
.MatchWildcards = True
While .Execute
oRng.Select
oRng.Start = oRng.Start + 1
oRng.InsertBefore "."
oRng.Collapse wdCollapseEnd
Wend
End With
End Sub
I appreciate your reply and helping me gain a better insight into the use of wildcards. Regards, Dave T. |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
How to suppress double ".." at the end of a sentence when a name ends "Inc."
|
dfolzenlogen | Mail Merge | 3 | 04-03-2022 08:49 PM |
| How do I add a missing full stop / period at the end of a paragraph? | Helend269 | Word VBA | 2 | 10-08-2020 10:18 AM |
| Let bookmark check if there are empty bookmarks before and place sentence there? | RevoMedia | Word VBA | 7 | 01-21-2020 08:04 AM |
Word 2016 - Where's Sentence length check
|
RightPaddock | Word | 1 | 08-22-2017 02:30 PM |
Open a video on full screen after I click on a sentence
|
ALFA_ENG | PowerPoint | 1 | 11-06-2015 01:17 AM |