CALL procname ([arglist])

Transfers control to a subroutine or function.


procnameThe name of the procedure.
arglist(Optional) The comma delimited list of variables to pass to the procedure.

REMARKS
* It is good programming practice to always use "Call" when transferring control.
* When you transfer control without using "Call" you do not have to include parentheses around your arguments.
* This can be used to call functions as well as subroutines.
* When you call a function the returned value is discarded.

Call procname(arg1, arg2) 
procname arg1, arg2

Sub Testing()
    Call MySubroutine1
    MySubroutine1 'not good practice

    Call MySubroutine2(20)
    MySubroutine2 20 'not good practice

'ignores return value
    Call MyFunction1
    MyFunction1 'not good practice

'ignores return value
    Call MyFunction2("text")
    MyFunction2 "text" 'not good practice
End Sub

Sub MySubroutine1()
'nothing
End Sub

Sub MySubroutine2(ByVal number As Double)
'nothing
End Sub

Function MyFunction1() As String
    MyFunction1 = "text"
End Function

Function MyFunction2(ByVal str As String) As String
    MyFunction2 = "text"
End Function

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