![]() |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
![]()
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, |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Kalü | Word VBA | 22 | 04-24-2018 05:35 AM |
![]() |
paik1002 | Word VBA | 4 | 12-07-2015 11:24 PM |
![]() |
paulkaye | Word | 3 | 12-22-2014 02:52 AM |
![]() |
rsrasc | Word VBA | 3 | 11-11-2014 03:55 PM |
find - reading highlight - highlight all / highlight doesn't stick when saved | bobk544 | Word | 3 | 04-15-2009 03:31 PM |