![]() |
|
|||||||
|
|
|
Thread Tools | Display Modes |
|
|
|
#1
|
|||
|
|||
|
this should replace paragraph mark with a space on the selection only
but it applies to the selection and paragraph marks after the selection it was created with record macro functionality Code:
Sub clean()
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^p"
.Replacement.Text = " "
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchKashida = False
.MatchDiacritics = False
.MatchAlefHamza = False
.MatchControl = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
|
|
#2
|
||||
|
||||
|
The issue is the wdFindAsk. Try .Wrap = wdFindStop instead.
And clean it up a little to bring it all inside the With...End With - I don't know why Microsoft records this abnormality Code:
Sub clean()
With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "^p"
.Replacement.Text = " "
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchKashida = False
.MatchDiacritics = False
.MatchAlefHamza = False
.MatchControl = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute Replace:=wdReplaceAll
End With
End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
#3
|
|||
|
|||
|
thanks! it works
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Skip double paragraph mark during find and replace in MS Word?
|
Jakov93 | Word VBA | 2 | 07-13-2021 11:07 PM |
| Accepting track changes via macro skips last paragraph mark, but not when accepting via Review menu | Peterson | Word VBA | 3 | 03-25-2020 10:03 PM |
Replace space with paragraph mark
|
jeffreybrown | Word VBA | 8 | 08-22-2018 03:31 PM |
Paragraph marks appear suddently
|
leonardevens | Word | 1 | 07-13-2015 12:14 PM |
Replace paragraph-marks (line-breaks) in tables with a character-string
|
Aztec | Word VBA | 2 | 04-02-2013 10:52 PM |