AddObject

<< Click to Display Table of Contents >>

 

AddObject

AddObject(ClassName, [Activate], [ObjectName])

This method adds a new object to an application. This method contains a ClassName parameter, which indicates the type of object to create. For example, to create a rectangle on a Screen, the ClassName parameter must be equal to "DrawRect". The object created that way is contained inside the object that called this method, and can be accessed using the Item method.

The Activate parameter is optional and indicates whether an object is enabled after creating it or not. If an object is activated, Links and scripts remain enabled. If an object is created with Activate equal to False, it can be later activated using the Activate method. If this parameter is omitted, the object is activated after creation. The value configured in this parameter is used to configure the IsObjectActive property of the object created.

The ObjectName parameter is also optional and indicates a name for this new object. In case this name already exists, the new name is automatically incremented. If this parameter is omitted, the new object is named after the class defined in the ClassName parameter. Please check the general Name property for more information about the allowed characters on the names of objects.

An object is created only if its type is compatible with the object that contains it. To ensure that an object was created, users can use VBScript's IsObject method.

 

NOTE

Only objects with an Insert option on their contextual menu can use this method.

Was this page useful?