Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 06-01-2021, 07:52 PM
Cendrinne's Avatar
Cendrinne Cendrinne is offline Help with a logical code, end of paragraph lines Windows 10 Help with a logical code, end of paragraph lines Office 2019
Competent Performer
Help with a logical code, end of paragraph lines
 
Join Date: Aug 2019
Location: Montreal Quebec Canada
Posts: 200
Cendrinne is on a distinguished road
Smile I've done many test, and I say you should be confidant!!!!

Quote:
Originally Posted by Guessed View Post
This appears to work but I would need to see a big data set to be confident in it
Code:
Sub NoBreaksForTheWicked()
  Dim aRng As Range, iLine1 As Integer, iLine2 As Integer
  Set aRng = ActiveDocument.Range
  With aRng.Find
    .Text = "(\(<*) "
    .Replacement.Text = "\1^l"
    .Forward = True
    .MatchWildcards = True
    .Wrap = wdFindStop
    Do While .Execute
      iLine1 = aRng.Information(wdFirstCharacterLineNumber)
      aRng.Collapse Direction:=wdCollapseEnd
      iLine2 = aRng.Words(1).Information(wdFirstCharacterLineNumber)
      If iLine2 <> iLine1 Then
        aRng.MoveStart Unit:=wdCharacter, Count:=-1
        aRng.Text = Chr(160)
      End If
      aRng.Collapse Direction:=wdCollapseEnd
    Loop
  End With
End Sub
Andrew, I've tested on a small paragraph, and then tried on 5 pages worth of text with mixture of open parenthese with a word, in the middle of the paragraph and some at the end. Those in the middle, I've put the font color in Red, those at the end of the line, I've highlighted. So I can confirm, only those that were highlighted where affected.

So YES you can be confidant.

Thank you both of you, Guessed, and Macropod. You are both Great Mind Thinkers and Helpers.

I thank you from the bottom of my heart

Cendrinne
Reply With Quote
 

Tags
help end of sentence, long paragraphs



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with a logical code, end of paragraph lines How to change the line spacing between just 2 lines within a paragraph Swarup Word 4 06-26-2019 02:32 PM
How to get rid of horizontal lines after each paragraph? Nisus Word 10 10-08-2018 01:15 PM
double spaced within paragraph 2 blank lines between paragraphs BigOldArt Word 1 08-24-2017 09:08 AM
Help with a logical code, end of paragraph lines Lines refuse to merge into one paragraph (Word 2010) Chris24 Word 2 01-22-2017 03:00 PM
Help with a logical code, end of paragraph lines Keep Paragraph Lines Together Issue SQLUSA Word 2 06-23-2012 05:00 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:51 PM.


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