View Single Post
 
Old 09-12-2015, 08:34 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

It seems to me you could not this with nothing more complicated than a wildcard Find/Replace, where:
Find = ^13[0-9]{1,}.
Replace = ^pAns.^&
Or, if you also want the solid line above 'Ans.', you could first create such a paragraph, then cut it to the clipboard and use:
Find/Replace, where:
Find = (^13)([0-9]{1,}.)
Replace = \1^c\2
Another way - and probably the best if you want the solid line - is to define a paragraph Style for it and use:
Find = ^13[0-9]{1,}.
Replace = ^pAns.^&
then
Find = Ans.^13
Replace = ^&
where the 'Replace' expression also includes the Style name.

None of this requires a macro, though the Find/Replace could be turned into one, and would be much faster on a long document and more reliable in any length document than looping through all the paragraphs.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote