BOM in Excel, find pdf files and place in another folder.

Hi all,

This is more of an Excel VBA question. I have exported the BOM list from PDM and I have written a Macro that deletes all unimportant information from that file.

I end up with a list of only the part numbers I need:

Example:

FM.00.620.004

SA00078195

SA00110545
SA00100546
SP.00.103.123
SA00051007

I need the macro to search for each row the corresponding pdf file (solidworks drawing) in folder "Released Drawings" and then copy/paste them all in folder B. (best is if that folder is being created in a certain location with the value of the FM row)

The pdf files have the following names: (for example)

FM.00.620.004_C.pdf

SA00078195_A.pdf

SA00110545_D.pdf
SA00100546_A.pdf
SP.00.103.123_A.pdf
SA00051007_B.pdf

So it needs to look for the latest version of a file (when a file ends with _D, there is also a _C variant. It needs to select the D variant. it will also have the newest date)

Update 1, made the create folder myself with (in a loop):

          If InStr(StrConv(ActiveCell, vbUpperCase), "FM") = 1 Then         

          Fldr_name = "D:\Spare Part Generator\MRD Final\" & ActiveCell

          FSO.CreateFolder (Fldr_name)

SolidworksApi/macros