Name
CallByName Function
Class
Microsoft.VisualBasic.Interaction
Named Arguments
Yes, if Args
( ) is
omitted
Syntax
CallByName(Object, ProcName, UseCallType, Args( ))-
Object Use: Required
Data Type: Object
A reference to the object containing the procedure being called.
-
ProcName Use: Required
Data Type: String
The name of the procedure to call.
-
UseCallType Use: Required
Data Type:
CallTypeConstantA constant of the type
CallTypeindicating what type of procedure is being called.CallTypeconstants are listed in the following table.
|
Constant |
Value |
Description |
|---|---|---|
|
|
1 |
The called procedure is a method. |
|
|
2 |
The called procedure retrieves a property value. |
|
|
4 |
The called procedure sets the value of a property. |
-
Args Use: Optional
Data Type: Any
A ParamArray argument representing the arguments required by the procedure being called.
Return Value
Depends on the return value (if any) of the called procedure
Description
Provides a method for calling a class member by name.
Since ProcName is a string expression,
rather than the literal name of a routine, it is possible to call
routines dynamically at runtime using a string variable to hold the
various procedure names.
Rules at a Glance
The return type of
CallByNameis the return type of the called procedure.ProcNameis not case sensitive.UseCallTypecan either be a numeric value or a constant of theCallTypeenumeration. In the latter case, the enumeration name must be specified along with the constant name, as in CallType.Method. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access