Hello!
This is a doozy, so I'm not holding my breath, but I believe in you!
I have a list of item IDs (e.g., SCBW1460, all follow the pattern of 4 letters then 4 numbers) in an Excel sheet. This list currently has 200 entries, all in column A, nothing else in the sheet. A1 has a header in it, "List". This list may expand or contract, so I don't want the macro to be limited to just 200 items.
I also have a Word document that contains exam questions, options, and answers. This document is 1873 pages long, and it contains the 200 items listed in the Excel file, along with 1000s of others, in no particular order. I want to pull out these 200 items and put ONLY them in a new Word doc. In this 1873 page Word doc, every exam item "chunk" begins with "Item Stem: ", with the item ID after it, so, for example, "Item Stem: SCBW1460". This is always its own paragraph, no other text is in that line. After this line, many things can happen, but the exam item always ends with "Answer: " then the correct answer as a single letter, so, for example, "Answer: C". Again, this is the only data in that paragraph/line.
I'm wondering if a macro can be written that looks in the Excel list for the first item ID, switches to the 1873 page Word doc, finds the item ID, selects the paragraph/line with that item ID, then goes down until it finds the first "Answer: " paragraph/line, selects it and all the text between, copies the selected text, switches to another Word doc (let's say it's already existing and is empty, called "subset.docx"), pastes the selection, adds 2 manual line returns so the items are clearly separated, then starts over and looks at the next item ID in the Excel file, finds it in the 1873 page Word doc, etc.
Each item ID is unique, so no issues there.
And, if this can be done, I'm sure there's a better way than what I describe above, so I'm open to other ideas.
Here's a sample of a simple Word item:
Item Stem: SCBD9100
How hot is the sun?
Option Set: XCAU8464
(A) Pretty cool
(B) Tepid
(C) Warmish
(D) Hot
(F) Scorching
Answer: F
Anything, however, can be between "Item Stem:" and "Answer:" though, like tables, lots of paragraphs, etc.
Thanks in advance for your time and effort!
This is a doozy, so I'm not holding my breath, but I believe in you!
I have a list of item IDs (e.g., SCBW1460, all follow the pattern of 4 letters then 4 numbers) in an Excel sheet. This list currently has 200 entries, all in column A, nothing else in the sheet. A1 has a header in it, "List". This list may expand or contract, so I don't want the macro to be limited to just 200 items.
I also have a Word document that contains exam questions, options, and answers. This document is 1873 pages long, and it contains the 200 items listed in the Excel file, along with 1000s of others, in no particular order. I want to pull out these 200 items and put ONLY them in a new Word doc. In this 1873 page Word doc, every exam item "chunk" begins with "Item Stem: ", with the item ID after it, so, for example, "Item Stem: SCBW1460". This is always its own paragraph, no other text is in that line. After this line, many things can happen, but the exam item always ends with "Answer: " then the correct answer as a single letter, so, for example, "Answer: C". Again, this is the only data in that paragraph/line.
I'm wondering if a macro can be written that looks in the Excel list for the first item ID, switches to the 1873 page Word doc, finds the item ID, selects the paragraph/line with that item ID, then goes down until it finds the first "Answer: " paragraph/line, selects it and all the text between, copies the selected text, switches to another Word doc (let's say it's already existing and is empty, called "subset.docx"), pastes the selection, adds 2 manual line returns so the items are clearly separated, then starts over and looks at the next item ID in the Excel file, finds it in the 1873 page Word doc, etc.
Each item ID is unique, so no issues there.
And, if this can be done, I'm sure there's a better way than what I describe above, so I'm open to other ideas.
Here's a sample of a simple Word item:
Item Stem: SCBD9100
How hot is the sun?
Option Set: XCAU8464
(A) Pretty cool
(B) Tepid
(C) Warmish
(D) Hot
(F) Scorching
Answer: F
Anything, however, can be between "Item Stem:" and "Answer:" though, like tables, lots of paragraphs, etc.
Thanks in advance for your time and effort!