GetObjectByName Method

Applies to TestComplete 15.61, last modified on February 20, 2024


Use the GetObjectByName method to obtain a program object by its name.



IntegrationObj An expression, variable or parameter that specifies a reference to an Integration object
ObjectName [in]    Required    String    
Result Object

Applies To

The method is applied to the following object:


The method has the following parameter:


Specifies the name of the desired program object.

Result Value

A reference to the specified program object or an empty Variant value, if the specified object does not exist or is unavailable.


The method returns the program object only if TestComplete is running script routines. If the script code is not running, the method returns an empty Variant value.


The code below demonstrates how you can use the GetObjectByName method to access TestComplete project variables.

Visual Basic

Sub Test()

  Dim TestCompleteApp As TestCompleteApplication
  Dim IntegrationObject As ItcIntegration
  Dim LastResult As ItcIntegrationResultDescription

  ' Create an application object
  Set TestCompleteApp = CreateObject("TestComplete.TestCompleteApplication.15")

  ' Obtain an integration object
  Set IntegrationObject = TestCompleteApp.Integration

  ' Obtain the Project program object
  Set ProjectObj = IntegrationObjectj.GetObjectByName("Project")

  ' Obtain the variable collection
  Set VarCol = ProjectObj.Variables

  ' ....

  ' Close TestComplete

End Sub

See Also

Working With TestComplete via COM - Overview

Highlight search results