M
MikeZz
I get a 100 page document (rtf that has lots of tables) which lists numerous
product changes. Each product has a part number, description, etc... and I
want to search through the document and find all the part changes.
I'm pretty good at Excel VBA but never tried Word so this is what I did.
I recorded the following macro:
Searched for repeating known string at the beginning of each part number:
Selection.Find.ClearFormatting
With Selection.Find
.Text = "Product/DRD FAM"
.Forward = True
.Wrap = wdFindContinue
End With
I know that once I find this text, I can just tab 7 times (data is in a
table) to get to the actual info I need so this is what VBA recorded:
Selection.MoveRight Unit:=wdCell ' but 7 times.
Tabbing 7 times gets me to the part number in the table.
Then the macro recorded:
Selection.Copy ' to copy the actual PN but I would put this into an
array.
Then I want to tab 2 more times to get the part description and pull that
info into the array as well.
After that's done, I want to find the next time "Product/DRD FAM" is found
and repeat my copying of info.
When I have all the info, I want to dump it into an excel file.
btw, the file format is an "rtf" file, if that makes a difference.
Thanks!
product changes. Each product has a part number, description, etc... and I
want to search through the document and find all the part changes.
I'm pretty good at Excel VBA but never tried Word so this is what I did.
I recorded the following macro:
Searched for repeating known string at the beginning of each part number:
Selection.Find.ClearFormatting
With Selection.Find
.Text = "Product/DRD FAM"
.Forward = True
.Wrap = wdFindContinue
End With
I know that once I find this text, I can just tab 7 times (data is in a
table) to get to the actual info I need so this is what VBA recorded:
Selection.MoveRight Unit:=wdCell ' but 7 times.
Tabbing 7 times gets me to the part number in the table.
Then the macro recorded:
Selection.Copy ' to copy the actual PN but I would put this into an
array.
Then I want to tab 2 more times to get the part description and pull that
info into the array as well.
After that's done, I want to find the next time "Product/DRD FAM" is found
and repeat my copying of info.
When I have all the info, I want to dump it into an excel file.
btw, the file format is an "rtf" file, if that makes a difference.
Thanks!