Repository.Variable.AddVariable

Adds a new variable resource 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 project, the name will be incremented automatically. For example, if "Var1" already exists, the new variable might be renamed to "Var2," "Var3," etc.

Syntax
.Variable.AddVariable(var)

Parameters
var
 * Required. The cVariable object that represents the variable resource to be added.

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

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