Extract the file name and specific paragraph from a word file and save in a excel sheet

nbuddhi

New Member
Joined
Jun 23, 2020
Messages
29
Office Version
  1. 365
Platform
  1. Windows
Dear Team,

I have thousands of word files in a folder called "E:\LAB_22_AUG_21\FILTERED_DOCX" and I have to extract the 1st instant of full paragraph content "REPORT NO" texts. (It will be always one line paragraph with the format of "REPORT NO : (ABC12)0123-012345" will be repeated on each pages, so that have to find only the 1st instant). Once "Report No" data captured, same to be included into a new excel workbook/sheet, column "A" and particular word document name to be included into next column after the report number column. Once recorded the the "Report No" and "file name", has to go to next file and this process will be repeated till last file.

Thanks & Best Rgds,
Nuwan Buddhika.
 

Attachments

  • Image.jpg
    Image.jpg
    76.2 KB · Views: 10
You are welcome Nuwan. Thanks for posting your outcome. You may want to trial the following code to remove the "REPORT NO:" part of the return. Dave
Code:
Sheets("Sheet1").Range("A" & Counter) = _
Right(WdApp.ActiveDocument.Paragraphs(Cnt).Range.Text, _
   Len(WdApp.ActiveDocument.Paragraphs(Cnt).Range.Text) - 10)
Thanks a lot Dave. You are an amazing mankind. Blessed be.
 
Upvote 0

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Forum statistics

Threads
1,214,611
Messages
6,120,510
Members
448,967
Latest member
screechyboy79

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top