Create a Variable Using a Function or Subroutine

  1. Choose Tools tab→Variables group→Variables .

  2. In the Variable Table, in the Unit Type list, select the unit type. This is the unit type for the variables value. The default type is Distance.

    Note:

    To store a value without units, select Scalar from the list.

  3. In the Name column, click an empty cell.

  4. Type a name for the variable that you want to create. Press Enter.

  5. In the same row, in the Formula column, click a cell.

  6. Click the Function Wizard button.

  7. Click the function that you want in the Function Wizard dialog box.

  8. Enter the appropriate values in the dialog box. The Function Wizard dialog box displays the available functions and appropriate input. For example, if the variables Var1 and Var2 already exist, some valid formulas using functions are as follows:

    Sqr(Var1) * Sin(Var2)

    Sqr( Var1^2 + Var2^2 )

Note:

  • You can write external functions and subroutines in VBScript and use them as variable formulas. You can write these functions in Visual Basic, or any text editor, and save them in a .BAS file. The Function Wizard steps you through the process of selecting the module file, the specific function or subroutine, and the necessary input and output.

  • If you type a function and you cannot remember the argument list, press CTRL+A after you have typed the equal sign, function name, and opening parenthesis. This activates the Function Wizard with the function already selected for you.

  • You can also enter expressions with functions directly in the cell in the Formula column.

What are you looking for?
Learn more about
Look up more details