CallByName function
Summary
Executes a method of an object, or sets or returns a property of an object.
Syntax
CallByName (object, procname, calltype, [args()]_)
The CallByName function syntax has these named arguments:
Part
Description
objectRequired: Variant (Object). The name of the object on which the function will be executed.
procnameRequired: Variant (String). A string expression containing the name of a property or method of the object.
calltypeRequired: Constant. A constant of type vbCallType representing the type of procedure being called.
args()Optional: Variant (Array).
Part
Description
objectRequired: Variant (Object). The name of the object on which the function will be executed.
procnameRequired: Variant (String). A string expression containing the name of a property or method of the object.
calltypeRequired: Constant. A constant of type vbCallType representing the type of procedure being called.
args()Optional: Variant (Array).
Example
Remarks
The CallByName function is used to get or set a property, or invoke a method at run time by using a string name.
In the following example, the first line uses CallByName to set the MousePointer property of a text box, the second line gets the value of the MousePointer property, and the third line invokes the Move method to move the text box.
CallByName Text1, "MousePointer", vbLet, vbCrosshair
Result = CallByName (Text1, "MousePointer", vbGet)
CallByName Text1, "Move", vbMethod, 100, 100
The CallByName function is used to get or set a property, or invoke a method at run time by using a string name.
In the following example, the first line uses CallByName to set the MousePointer property of a text box, the second line gets the value of the MousePointer property, and the third line invokes the Move method to move the text box.
CallByName Text1, "MousePointer", vbLet, vbCrosshair
Result = CallByName (Text1, "MousePointer", vbGet)
CallByName Text1, "Move", vbMethod, 100, 100