Ich habe dieses kleine Makro, dessen Zweck es ist, alle leeren Absätze (^ p) zu entfernen und dann alle Absätze auszuwählen und nach und vor Leerzeichen hinzuzufügen (je 6 Punkte) .Word-VBA-Makro, um leere Absätze zu leeren und Leerzeichen nach und vor hinzuzufügen
Dies ist der Code so weit
Sub format()
ActiveDocument.Range.Select
' Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.text = "^p^p"
.Replacement.text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = False
.MatchFuzzy = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
iParCount = ActiveDocument.Paragraphs.Count
For J = 1 To iParCount
ActiveDocument.Paragraphs(J).SpaceAfter = 6
ActiveDocument.Paragraphs(J).SpaceBefore = 6
Next J
End Sub
Jedoch, wenn ich es laufen, alles, was ein einzelner Absatz wird. Nehme an Ich habe wie (^ p sind leere Absätze)
paragraph 1
^p
paragraph 2
^p
paragraph 3
Ich bekomme immer
paragraph 1 paragraph 2 paragraph 3
Was mache ich falsch? Vielen Dank!
Sie "vor" Absatzbeispiel ist falsch. Schau dir deine Absätze noch einmal an. dann überlegen Sie, was Sie mit was ersetzen – jsotola