
When the function is called from the ConvertTemp Sub procedure, a variable containing the argument value is passed to the function. In the following example, the Celsius function calculates degrees Celsius from degrees Fahrenheit. The return type of a Function is always a Variant. A Function returns a value by assigning a value to its name in one or more statements of the procedure. If a Function procedure has no arguments, its Function statement must include an empty set of parentheses. A Function procedure can take arguments (constants, variables, or expressions that are passed to it by a calling procedure).

A Function procedure is similar to a Sub procedure, but can also return a value. MsgBox "The temperature is " & Celsius(temp) & " degrees C."Ī Function procedure is a series of VBScript statements enclosed by the Function and End Function statements. Temp = InputBox("Please enter the temperature in degrees F.", 1) The Function procedure is shown after the following discussion. The calculation is performed in a Function procedure created using VBScript. It then displays the results of a calculation based on that information. InputBox, to prompt a user for some information. The following Sub procedure uses two intrinsic, or built-in, VBScript functions, If a Sub procedure has no arguments, its Sub statement must include an empty set of parentheses (). A Sub procedure can take arguments (constants, variables, or expressions that are passed by a calling procedure). In VBScript there are two kinds of procedures the Sub procedure and the Function procedure.Ī Sub procedure is a series of VBScript statements, enclosed by Sub and End Sub statements, that perform actions but don't return a value. It is also used by the servers for the processing of web pages.VBScript Procedures Microsoft® Visual Basic® Scripting Edition It serves as similar to Javascript when it is accessed by the client in the field of Web development.


This environment is specified for working and running VBScript. VBScript is allowed to use a model named Component Object Model to avail the elements and tools of the environment. In the computing environment, the user is allowed to access and control many aspects of it. VBS or VBScript is connected with the script edition of Microsoft Visual Basic.
