Hi Jon,
Your macro doesn't work with the sample you posted (there's no "newrdn:"),
so I'm not sure what it's supposed to do.
So let me make a sample that works...:
((Before))
~~~~~~~~~~~~
dn: cn=group,ou=org,o=root
changetype:modify
add:equivalentToMe
equivalentToMe:cn=name,o=root
replace:Member
Member:
~~~~~~~~~~~~
((After))
~~~~~~~~~~~~
dn: cn=group,ou=org,o=root
changetype:modify
add:equivalentToMe
equivalentToMe:cn=name,o=root
replace:Member
Member: cn=group
~~~~~~~~~~~~
You could do that with a wildcard replacement.
In the "Find/Replace" dialog, check "Match wildcards".
First, you'll have to figure out what you want to copy to the other
location, and put it in braces:
Find what: dn: (cn=[!,]@),
The braces allow you to re-insert that expression later.
Let's also match the following text, up to where we want to insert the
group:
dn:[!^13^11]@(cn=[!,]@),*Member:
(Instead of both [!^13^11]@ and [!,]@ you could also use the * wildcard, but
it's safter to restrict matches a bit)
Now, we want to leave everything as it was, and insert a blank and the stuff
from the second group:
Replace with: ^& \1
^& inserts the whole stuff you matched, \1 puts in what you matched in your
(first) braced expression.
If that's not what you had in mind, exactly, maybe you can figure out how to
adapt that wildcard replacement... or post back!
Regards,
Klaus
Thank you for responding. OK, here is the macro I recorded. What I
need to do via a macro is copy, paste and repeat throughout the entire
document. The format of the document is:
dn: cn=group,ou=org,o=root
changetype:modify
add:equivalentToMe
equivalentToMe:cn=name,o=root
I need the macro to copy and paste the "cn=" portion from
"equivalentToMe:" to "Member:"
The following macro works but I need it to repeat through the entire
file, or if you have a better way of doing what I need, that would
help as well.
Selection.Find.ClearFormatting
With Selection.Find
.Text = "cn=""*"""
.Replacement.Text = "oldr"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute
Selection.copy
Selection.EndKey Unit:=wdLine
Selection.Find.ClearFormatting
With Selection.Find
.Text = "newrdn:"
.Replacement.Text = "oldr"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.PasteAndFormat (wdPasteDefault)
Repeat
End Sub