#1
|
|||
|
|||
Add spaces between sentences
Hi community,
I have edited the macro based on Gregory K. Maxey's TwoSpacesAfterSentence (The Anchorage - 404 Redirect Code:
Sub TwoSpacesAfterSentence() Dim oRng As Range Set oRng = ActiveDocument.Range With oRng.Find .ClearFormatting .MatchWildcards = True .Text = "(*{2})([.\!\?])([A-Z])" .Replacement.Text = "\1\2 \3" 'Two spaces between 2 and \ .Execute Replace:=wdReplaceAll .Text = "(*{2})([.\!\?]) ([A-Z])" .Replacement.Text = "\1\2 \3" 'Two spaces between 2 and \ .Execute Replace:=wdReplaceAll .Text = "([.\!\?]) {3,}([A-Z])" .Replacement.Text = "\1 \2" .Execute Replace:=wdReplaceAll 'This should prevent most cases of improper double spacing 'in names (e.g., F. Lee Bailey, George W. Bush, etc.) .Text = "([!A-Z][A-Z].) ([A-Z])" 'Two spaces between ) and ( .Replacement.Text = "\1 \2" .Execute Replace:=wdReplaceAll End With lbl_exit: Exit Sub End Sub I tried to add "Application.ScreenUpdating = False" at the very first begining of the code and it runs a little bit faster. However, it still cannot be ran successfully in a more than 100 pages documents. How to solve this issue? Your help will be greatly appreciated! |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
VBA semi colon at end of sentences | Shelley Lou | Word VBA | 5 | 05-28-2021 02:35 AM |
Alignment of sentences | aditya@office | Excel | 11 | 09-24-2019 06:22 AM |
remove dependency between sentences | Baby_1 | Word | 3 | 07-18-2017 12:39 AM |
Consolidating Sentences into One Paragraph | ctsolar | Word | 4 | 12-16-2013 04:50 PM |
Postformatting spaces between sentences using auto correct? | Chunk | Word | 4 | 05-12-2011 06:06 AM |