Batch Replace Components In Assembly Based on Configuration Name

I'm looking for a way to batch replace components in an assembly based on the configuration name. 

The idea is to start with a "Part" that has configurations 'PartA', 'PartB'....and so on.  The macro would find every instance of "Part" in the assembly, read the config name used in that instance (say PartA), and then replace that instance with a part in the folder named "PartA".  

Can anyone help me out with this? 

Any help would be greatly appreciated. 

Thanks

--Ryan 

SolidworksApi/macros