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.

* 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.
* For the Microsoft documentation refer to

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()
End Sub

Sub MySubroutine2(ByVal number As Double)
End Sub

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

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

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