Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 06-11-2021, 09:39 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
Default On a given paragraph, this script below didn't work......

Hello, Andrew,
I don't want to leave you with the impression, it worked all the time, cause in one case, it didn't. Didn't even flintch. So I want to let the readers here read it's not a 100% working script in those circumstances.

Besides, does it exist and 100% full proof script? Or it's normal, it might not work all the time? I guess it depends if one variable is different than the test I've done previously.

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
It's ok, the one from Macropod worked.

I rather have a backup plan, than just one. Especially when time is an issue.

Regardless, I love then help I get from this forum. I learn so much from people here

Until next time.

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 07:26 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