![]() |
|
#10
|
||||
|
||||
|
I don't know what 'TST_End_of_Sentence_' is about, but it seems to suggest you're running some sort of loop. Your code is also slow because of its heavy use of Selection.
With the Find/Replace operation I suggested, there'd be no looping through the content. All you'd use is: Code:
Sub Demo()
Application.ScreenUpdating = False
With ActiveDocument.Range
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "([\(«]*>)^32"
.Replacement.Text = "\1^s"
.Forward = True
.Format = False
.Wrap = wdFindContinue
.MatchWildcards = True
.Execute Replace:=wdReplaceAll
End With
End With
Application.ScreenUpdating = True
End Sub
.Text = "(*>)^32(A-Z)" .Replacement.Text = "\1^s\2" would replace an ordinary space before any upper-case letter with a non-breaking space. Why would you do that? Similarly, .Text = "([%$])" .Replacement.Text = "^s\1" would insert a non-breaking space before % or $, even if there's already a space there, with the potential of ending up with both a space (which may or not be a non-breaking space) followed by non-breaking space.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
| Tags |
| help end of sentence, long paragraphs |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
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 |
Lines refuse to merge into one paragraph (Word 2010)
|
Chris24 | Word | 2 | 01-22-2017 03:00 PM |
Keep Paragraph Lines Together Issue
|
SQLUSA | Word | 2 | 06-23-2012 05:00 PM |