CALLBYNAME(object, procname, calltype [,args])

Returns, sets or executes a method or property of an object (Variant).

objectThe object name which the function will be executed on (Object).
procnameThe name of a property or method of the object (String).
calltypeA vbCallType constant that specifies the type of procedure being called:
args(Optional) The array of possible arguments (Array).

* This only works with class objects.
* If your code is not in a class then you can use Application.Run.
* This function is used to get or set a property, or invoke a method at run time using a string name.
* The equivalent .NET function is Microsoft.VisualBasic.Interaction.CallByName
* For the Microsoft documentation refer to

CallByName "txtName1", "MousePointer", vbLet, vbCrosshair 
Call CallByName("txtName1", "MousePointer", vbLet, vbCrosshair)

vResult = CallByName("txtName1", "MousePointer", vbGet)

CallByName "txtName1", "Move", vbMethod, 100, 100

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited Top