Printable Version of Topic

Click here to view this topic in its original format

UtterAccess Forums _ Microsoft Word _ How To Extract The Same Data From The Same Position?

Posted by: aligator510 Nov 5 2019, 09:26 AM

Hi everyone,

I have a word document with 500 or more pages.
The text in every page is the same exept the adresses and person name which diferent for every page.
I want to extract these data (person name & adress) in an new excel format, keeping the same queue like in the word document.
I appreciate any help!

Thank in advance!

Posted by: kfield7 Nov 5 2019, 11:55 AM

Are the pages (name & address specifically) bookmarked?
If not, is there a leading phrase that can be used to find them?
e.g.

Name: John Doe

If so, then VBA could be used to search for the data and populate the Excel sheet.
I would opt to put the VBA in the Excel sheet (as opposed to the Word doc) so you can re-use the sheet/macro as needed.

It would look something like:

Get filename
Open Word doc
do until end of doc
Search for "Name:" using .find, or search for the bookmark
Copy the name to a variable
same for address
write the name and address to the next available row in Excel.
loop
close doc

I left out a lot of particulars, but I thought I'd start with the concept.