Ed said:
In a .txt file, I have three lines repeated - it's a manually
formatted "section break", with a paragraph mark at the
end of each line. When coding Selection.Find, can I input
all three lines/paragraphs at .Text = " " ?
Hi Ed,
You can find the placeholders for these and other formatting characters in
the "Edit > Replace" dialog unter the "Special" button:
^p = paragraph mark
^m = section break
So if you'd want to search, say, for a section break followed by two
paragragraph marks, you'd use .Text = "^m^p^p".
If you want to delete part of the paragraph marks/section breaks, it may be
safer to use a wildcard replacement.
In wildcard replacements, you have to use ^13 for a paragraph mark instead
of ^p (for unknown reasons).
If you want to delete the first paragraph mark after the section break:
Find what: (^m)^13(^13) ((with "Match wildcards" checked))
Replace with: \1\2
With a wildcard replacement, you can be sure that Word won't touch the
formatting of the section break or paragraph mark. If you had replaced
^m^p^p woth ^m^p, you'd have to rely on Word to be "smart" about keeping the
formatting, which might or might not work out.
Greetings,
Klaus