Hi Nexan,
Should work fine... if there's a paragraph mark above the "SAMPLE NAME:" line.
You might also want to go to the start of the document first... else the search might miss the "record" you're in:
Selection.HomeKey Unit:=wdStory
BTW, use ^p or \1 instead of ^013 in the replacement text.
^013 will insert a character that looks like a paragraph mark, but doesn't act like one (... doesn't store the paragraph formatting such as the style).
Greetings,
Klaus
> Thanks, Jezebel! Follow-up question, though: now I'm trying to move the DATE
> line to the top of the list below:
[quoted text clipped - 95 lines]
>> >
>> > Thanks!
Nexan - 07 Jun 2005 21:33 GMT
Klaus,
Okay, I've switched to this:
With Selection.Find
.Text = "(^013)(SAMPLE*^013)(DATE*^013)"
.Replacement.Text = "^p\3\2"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = True
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Still no luck. Can you think of any other factors that might be at work here?
Thanks!
> Hi Nexan,
>
[quoted text clipped - 107 lines]
> >> >
> >> > Thanks!
Helmut Weber - 08 Jun 2005 11:41 GMT
Hi everybody,
May I propose something completely different?
If the document has a persistent structure,
that is blocks of 14 paragraphs, which means,
that it's end is an empty paragraph, too,
then...
Sub SwitchParagraphs()
' example for paragraphs 5 and 11
' in a doc a blocks of 14 paragraphs
Dim l As Long
With ActiveDocument.Paragraphs
For l = 1 To .Count Step 14
.Item(l + 4).Range.InsertBefore .Item(l + 10).Range.Text
.Item(l + 11).Range.Delete
Next
End With
End Sub
Sometimes wildcard search is tempting.
But hard to read and to understand for me sometimes, too.
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/