Highlight A Phrase In A Document, Then Find And Replace Something Only In The Highlighted Part?
Is it possible to highlight a phrase in a document, then find and replace something only in the highlighted part?
I would be too embarrassed to tell you the contortions I have been through to accomplish this in some macros.
It has been a slow dawning for me that there has got to be a better way.
Very often, I copy parts from four online input documents, paste them to one Word Document and let my macro combine these four inputs into many phrases which I then must paste into a couple of other new online documents.
Since I never know which exact line the inputs are on, the macro must find “Organization:” for example:
Part of the doc:
Lower Echelon: AFL of the CIO
Sub Department: CIO
Organization: AFL of the CIO From Hawaii
Top Agency: AFL of the CIO Incorporated
Then once the “Organization:” is found, the macro could easily highlight "AFL of the CIO From Hawaii" by extending from the : colon to the end of the line.
How would you replace “CIO” with “CIB” only in the highlighted part?
Lastly, all the highlighted part with the changes, "AFL of the CIB From Hawaii" need to go to the clipboard somehow. I do it this way: Selection.Copy
I know how to find and replace things in the whole document or only on the 1st line using range alright, but not a highlighted part.
Thanks,
|