Select part by name

I am trying to write a macro that replaces a specified component in an assembly.  The API help has a nice example of how to do the replace.  However, that only replaces the selected component.  I am trying to replace the part based on the name, say part-1@assembly. 

I think I need to use SelectByID2 and get a Component2, but I am having trouble putting it all together.  Can anyone help me out here?

SolidworksApi macros