To call a subroutine, you can use the Call statement or simply the name of the subroutine:
Call MyRoutine(firstParameter) 'Or MyRoutine firstParameter
Notice you don’t include the parentheses in the second case. If you do, VB assumes you mean them as an operator. VB then determines the value of the parameter and passes the value to the routine, instead of passing the reference as expected. This is apparent in this example:
This passes the text-box control to MyRoutine. If you did it without the Call statement, VB evaluates Text1, which returns the default property value of the text box:
This default property is the text-box text. So, if the routine expects a control, you pass the text string from the control instead and will receive a type-mismatch error. To prevent this, always use the Call statement or don’t put parentheses in when calling a subroutine.