I want to create a robot task for a specific robot under PPR tree using DELMIA vba. But I'm having trouble selecting the robot using its instance name. I've recorded the macro while changing the instance name of that robot (just to see how DELMIA does it) under PPR tree in Device Task Definition. But even the recorded code didn't work! Here's the code I've recorded:
Sub CATMain()
Dim processDocument1 As ProcessDocument
Set processDocument1 = DELMIA.ActiveDocument
Dim product1 As Product
Set product1 = processDocument1.GetItem("Resource") 'Runtime error '445' here
Dim products1 As Products
Set products1 = product1.Products
Dim product2 As Product
Set product2 = products1.Item("KR90 1.1")
product2.name = "KR90 1.11"
End Sub
The program got stuck in the line where 'product1' is set. It says "Run-time error '445': Object doesn't support this action. ". Is there any way to select this robot using its name by any means?