Syntax 

CallByName(Obj, ProcName, CallType, [expr[, ...]])


Group 

Flow Control 


Description 

Call an Obj's method/property, ProcName, by name. Pass the exprs to the method/property.


Parameters

Description

Obj 

Call the method/property for this object reference.

ProcName 

This string value is the name of the method/property to be called.

CallType 

Type of method/property call. See table below.

expr 

These expressions are passed to the obj's method/property.


CallType

Value

Effect

vbMethod

1

Call or evaluate the method.

vbGet

2

Evaluate the property's value.

vbLet

4

Assign the property's value.

vbSet

8

Set the property's reference.


Example

Sub Main

    On Error Resume Next

    CallByName Err, "Raise", vbMethod, 1

    Debug.Print CallByName(Err, "Number", vbGet) ' 1

End Sub