Repository.Variable.AddVariable

Saves a new cVariable object to the current project. Returns a Boolean value; when true, indicates a successful save.

If a variable with the same name already exists in the current project, the application will automatically increment the name. For example, if "Var1" already exists, the new variable might be renamed to "Var2," "Var3," etc.

Syntax
.Variable.AddVariable(var)

Parameters
var
 * The cVariable object to be added. (Required)

Example
This example creates a new variable resource, and then saves it in the first available project in a Synthesis repository. VBA MyRepository Repository newVariable cVariable NewVariable.Name = MyRepository.Project.SetCurrentProject(1) MyRepository.Variable.AddVariable(NewVariable)

VB.NET MyRepository Repository newVariable cVariable MyRepository.Project.SetCurrentProject(1) MyRepository.Variable.AddVariable(newVariable)