可以把所选内容中的硬回车替换为软回车
Sub 替换手动换行符成回车符() With Selection.Find .Text = "^p"; .Replacement.Text = "^l"; .Forward = False .Wrap = wdFindStop .Format = True .MatchCase = False .MatchWholeWord = False .MatchByte = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False .Execute Replace:=wdReplaceAll End With Selection.Style = "代码"; End Sub