AnsweredAssumed Answered

Does exists an API command to select a component without specifying the Instance Number?

Question asked by Paolo Magalini on Feb 4, 2021
Latest reply on Feb 6, 2021 by Paolo Magalini

Hello guys, in assembly mode I know that I can do an "in context" rename of components (Right Click on Component - > Component Properties -> Component Name) without changing the original file name. I believe this is a great utility to design complex models.


In VBA I can successfully point and select the "aliased" component using IComponent2::GetComponentByName() method but I am still obliged to know the instance number prior to execute the command. 

In the example below i show that a VBA script is selecting an aliased component but the instance number is still mandatory even if aliases are all different.


Question: Does exists a way to reference components from VBA disregards the instance numbers?


The component name are aliased


The script selects successfully an aliased component but instance number "-7" is still mandatory to reference it.


Thank you.