A
Amy
Hi, I would like to create a macro in Word where I can:
Select several paragraphs (doesn't matter how many).
Execute the macro.
The macro finds a piece of text (using wildcards) in the first paragraph of
the selection and moves it to the beginning of that paragraph.
Macro then moves on to next paragraph in the selection, finds the text, and
moves it to the beginning of that paragraph.
Etc.
I thought I could do it with Find/Replace, but it doesn't quite seem to work:
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "(<*>)^9([0-9]{1,})^13"
.Replacement.Text = "_\2^t\1^t1^p"
.Forward = False
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchKashida = False
.MatchDiacritics = False
.MatchAlefHamza = False
.MatchControl = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Any advice would be appreciated.
Thanks!
Amy
But I only want the selection to be affected, nothing else in the document.
Select several paragraphs (doesn't matter how many).
Execute the macro.
The macro finds a piece of text (using wildcards) in the first paragraph of
the selection and moves it to the beginning of that paragraph.
Macro then moves on to next paragraph in the selection, finds the text, and
moves it to the beginning of that paragraph.
Etc.
I thought I could do it with Find/Replace, but it doesn't quite seem to work:
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "(<*>)^9([0-9]{1,})^13"
.Replacement.Text = "_\2^t\1^t1^p"
.Forward = False
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchKashida = False
.MatchDiacritics = False
.MatchAlefHamza = False
.MatchControl = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Any advice would be appreciated.
Thanks!
Amy
But I only want the selection to be affected, nothing else in the document.