A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.
I am hoping someone can help asnwer this question:
Let's say I have a word "XYZ" scattered throughout my Word document. That Word document contains many heading levels, like:
How do I write a macro that can remove "XYZ" only if it is in the 4th
heading level (e.g. 18.104.22.168, 22.214.171.124, 126.96.36.199, etc.)?
Also, how do I make it so the macro can also search for text blocks that span multiple lines, like, for example,:
I want to be able to find and replace all text blocks that have exactly the above format and everything, including the bullets.
Word Macro Programming
Tuesday, May 06, 2008
For the first one:
You can use the Styles sidebar to select all paragraphs having the Heading 4 style —with the style contextual menu option 'Select all N instance(s)—, and then do a search and replace over the current selection (there is no option on the replace dialog for searching only the current selection, but by default word will only replace text on the selected paragraphs, and then will ask if you want to search the rest of the document.
If you have to do this on several documents, I think you can record this as an interactive macro and save it in the Normal.dot template. Then replay the macro on every document.
Regarding your second question, I really don't understand what are you trying to accomplish. What exactly are A, B, C and D?
This topic is archived. No further replies will be accepted.Other recent topics
Powered by FogBugz