CreateVar Method

Action2 Example

 

Encapsulates the AutoMate action in the 天ariables group, 鼎reate variable. The method creates a new variable for use in an AutoMate task.

 

Declaration

function CreateVar (varVarName As Variant,

varInitialValue As Variant) As Integer

 

Parameters

varVarName

 The name of the AutoMate variable to create.

 

varInitialValue

 The new variable痴 initial value.

 

Description

Use the CreateVar method to create a new AutoMate variable that can be accessed and modified within the currently executing AutoMate task.

 

When the script starts, AutoMate will automatically allocate the variables from your task into the script using the same names from the task. For example, if before the SCRIPT: step in your task you have created a variable called MYVAR, the variable MYVAR will be accessible in your script like any other regular variable. You can safely modify and work with this variable like another other VBA object. When the script ends, AutoMate will automatically write any changes you made to the variable back to the task.

 

If, however, you need to create a NEW variable to be passed back to AutoMate when the script is finished, you will need to use the CreateVar method to first create the variable, and explicitly set any changes to the variable using the SetVar method. This is because AutoMate can only track those variables that were created before the script started.