View Single Post
 
Old 08-01-2021, 11:32 PM
jec1 jec1 is offline Windows 7 32bit Office 2013
Advanced Beginner
 
Join Date: Jan 2012
Posts: 84
jec1 is on a distinguished road
Default

Every paragraph - this is really an old macro - must have left it half finished...

Every para - I just want it to run through the document text top to bottom - and remove trailing space - then call my Table Cell macro.

Below macro seems to work okay.

Sub jec_RemoveTrailingWhitespaceCR(control As IRibbonControl)
'
' RemoveTrailingWhitespace()
' This macro uses find and replace to remove trailing whitespace from the end of all the
' paragraphs in a document. The macro operates on whatever text is currently selected.
'
With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "^w^p"
.Replacement.Text = "^p"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute Replace:=wdReplaceAll
End With
Call jec_Purge_Trailing_SpaceTableCells
End Sub
Reply With Quote