How to change a part configuration with the API

My current code is attached. I want to set an if statement, when the InStr function finds a specific line in the string swComp.Name2, set that parts configuration to, whichever one I want to. How would I do that?

SolidworksApi macros