Customization > Automation Interface > Functions > Functions for Projects > ItemByID function (automation interface)
ItemByID function (automation interface)
Syntax:
ItemByID("<id>")
Where:
<id> is a string that specifies the id of the object to find.
The ItemByID function returns an object in a model searching on an "Id" index. You can use this function with the Project object only. If the object does not exist the function generates an error.
ItemByID uses the Id as an index, making it faster. The Id is permanent unlike other properties of an object which the user can change.
Examples
This example sets strObjectID to the ID of Class1, and then through the ItemByID function sets objSetByID to Class1 using its Id.
Set objItem = Dictionary.Item("Class", "Class1")
strObjectID = objItem.Property("Id")
Set obj SetByID = ActiveProject.ItemByID(strObjectID)