Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 10-03-2023, 04:16 PM
Dave T Dave T is offline Check if sentence ends with a full stop Windows 7 64bit Check if sentence ends with a full stop Office 2013
Advanced Beginner
Check if sentence ends with a full stop
 
Join Date: Nov 2014
Location: Australia
Posts: 66
Dave T is on a distinguished road
Default

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
Now I have two options to use.
I appreciate your reply and helping me gain a better insight into the use of wildcards.
Regards, Dave T.
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Check if sentence ends with a full stop 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
Check if sentence ends with a full stop Word 2016 - Where's Sentence length check RightPaddock Word 1 08-22-2017 02:30 PM
Check if sentence ends with a full stop Open a video on full screen after I click on a sentence ALFA_ENG PowerPoint 1 11-06-2015 01:17 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:22 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft