Remove the carriage return in Word

xiaoxiao2021-03-06  51

I have a netizen asked me how to get rid of a registered area in the Word file, spending a little time to make a macro, interested friends can refer to the source code, you can copy the source code to Word. In the VB editor, create a toolbar button in the Word file, the source code is as follows:

Sub macro1 () DIM I AS INTEGERDIM J AS INTEGER

I = Selection.Paragraphs.count - 1

Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "^ p" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchByte = True .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute For j = 1 To i With Selection If .Find.Forward = True Then .Collapse Direction: = wdCollapseStart Else .Collapse Direction: = wdCollapseEnd End If .Find.Execute Replace: = wdReplaceOne If .Find.Forward = True Then .Collapse Direction: = wdCollapseEnd Else .Collapse Direction: = wdCollapseStart End If .Find.Execute End With Next jEnd Sub the code above is in Word XP Under production.

转载请注明原文地址:https://www.9cbs.com/read-116198.html

New Post(0)