PDA

View Full Version : [SOLVED:] Copy specific text from Word to Excel using VBA



mvakharia
05-29-2020, 07:26 AM
Hello All,

I am trying to copy fields like Sales Order no. and Date with corresponding value from the word file (attached herewith). I am having multiple word files from where I need to search (different keywords) and copy paste it in my excel.
Also is there a possibility to copy the text from header?

Appreciate your help.

Regards,
Mayur

macropod
05-29-2020, 03:22 PM
There are multiple threads here showing how to extract data from Word documents and insert those data into Excel. What have you tried?

mvakharia
05-30-2020, 12:23 AM
There are multiple threads here showing how to extract data from Word documents and insert those data into Excel. What have you tried?

Thanks Paul for your response. I did look at "Import Words and Phrases from MS Word to Excel" but my issue is with searching on different text with corresponding values. e.g. here the 'Sales order' changes to "invoice number" in other word file and so on. Also wanted to know if we can fetch data from header.
With Regards,
Mayur

macropod
05-30-2020, 12:54 AM
There are threads discussing that here, too. For a very recent example, see: http://www.vbaexpress.com/forum/showthread.php?67346-Import-Words-and-Phrases-from-MS-Word-to-Excel

See also:
http://www.vbaexpress.com/forum/showthread.php?65295-Copying-the-tables-and-corresponding-section-header-from-a-word-using-excel-vba
http://www.vbaexpress.com/forum/showthread.php?63942-Extract-data-from-Word-to-Excel
http://www.vbaexpress.com/forum/showthread.php?61427-Need-help-to-copy-only-email-amp-phone-no-from-word-to-excel!!
http://www.vbaexpress.com/forum/showthread.php?42850-Import-text-from-word-document-into-excel
http://www.vbaexpress.com/forum/showthread.php?59212-Need-to-Pull-Specific-Data-Text-from-Word-to-Specific-Cells-in-Excel

mvakharia
05-31-2020, 06:43 AM
[QUOTE=macropod;402692]There are threads discussing that here, too. For a very recent example,

Thank you so much Paul. I used "Need to Pull Specific Data/Text from Word to Specific Cells in Excel" and it works fine!
Should I create an array as my search text will need to added / modified based on the word docs?

macropod
05-31-2020, 01:37 PM
Should I create an array as my search text will need to added / modified based on the word docs?That's up to you - but you'd probably have to do the same thing for the Replace expressions, too.

mvakharia
05-31-2020, 10:22 PM
Thank you! You are doing a very kind job of helping people. God bless you!