Had some code (a sub) that performed this long ago; can't find-- searched every advanced search hit on this site and haven't found anything yet - hoping a guru can help! Used to be able to attach sample of what the source content looks like and how I'm needing it laid into the excel file to try to make this easier; appears this option is gone? - Cross posting so I can attach a helpful file attachment example and needing help rather soon so the more eyes the better:
Using Excel VBA Extract Content from Word Doc
I know there's a ton of brilliant friends of many years here on MrExcel that can probably figure something out without a visual - but the link is available if needed!
*Do not need the code to open any files
(User will already have open 1 Excel file (ExampleExtractor.xlsm) and 1 Word file (LogRuleSourceXX.doc) open before running the SUB.
They will open each Word file one at a time -- and there's a large folder full - so I'm needing a sub like this again to expedite ongoing extractions).
THE 4 BASIC RULES THAT THE SUB SHOULD PERFORM:
1==If excel finds one of these rule words in All Caps [IF,AND,OR,PERFORM,THRU] in the Word doc, then copy the content that sits to the immediate RIGHT of that rule word & paste into Excel column C. (copy until a space occurs I think will work)
2==Then, pick up (copy/paste) the content that sits on the immediate RIGHT of the equals sign into Excel column D
(sometimes that content is in quotes - sometimes it's not - so not using quotes in the definition is probably more accurate (to just say in the code to pick up everything to the right of the equals sign on that same line) - and I'll parse off any extra garbage that I don't need)
3==Need the code to look at the Filename of the Word doc and extract the 12th+13th char position, paste that into Col E of Excel
4==Last, the code should locate the "Output" content which always follows the rule word: [TO], copy/paste into Col F of Excel
That's it!
(I threw those RULE WORDS into Col A as an idea that the code could look to that column when performing it's LOOKUP/INDEX -
but it's probably much better to just hard code them into a line of code and manage them there -- if so, disregard column A)
Forever in debt to you if you can figure out a decent sub to expedite this painful process...
Thanks, Chris
Using Excel VBA Extract Content from Word Doc
I know there's a ton of brilliant friends of many years here on MrExcel that can probably figure something out without a visual - but the link is available if needed!
*Do not need the code to open any files
(User will already have open 1 Excel file (ExampleExtractor.xlsm) and 1 Word file (LogRuleSourceXX.doc) open before running the SUB.
They will open each Word file one at a time -- and there's a large folder full - so I'm needing a sub like this again to expedite ongoing extractions).
THE 4 BASIC RULES THAT THE SUB SHOULD PERFORM:
1==If excel finds one of these rule words in All Caps [IF,AND,OR,PERFORM,THRU] in the Word doc, then copy the content that sits to the immediate RIGHT of that rule word & paste into Excel column C. (copy until a space occurs I think will work)
2==Then, pick up (copy/paste) the content that sits on the immediate RIGHT of the equals sign into Excel column D
(sometimes that content is in quotes - sometimes it's not - so not using quotes in the definition is probably more accurate (to just say in the code to pick up everything to the right of the equals sign on that same line) - and I'll parse off any extra garbage that I don't need)
3==Need the code to look at the Filename of the Word doc and extract the 12th+13th char position, paste that into Col E of Excel
4==Last, the code should locate the "Output" content which always follows the rule word: [TO], copy/paste into Col F of Excel
That's it!
(I threw those RULE WORDS into Col A as an idea that the code could look to that column when performing it's LOOKUP/INDEX -
but it's probably much better to just hard code them into a line of code and manage them there -- if so, disregard column A)
Forever in debt to you if you can figure out a decent sub to expedite this painful process...
Thanks, Chris