Storing Values When a Macro is Finished

23.08.2021

When a macro ends, the values contained in its variables are not automatically saved to a data carrier. If a value is to be preserved, it has to be saved outside of the macro before the macro finishes running.

Each FlexPro object in a FlexPro database, such as a data set, diagram or folder, has a Parameters list that can take any number of parameters. When working with FlexPro, you can edit this list of parameters by right-clicking with your mouse on an object, selecting Properties and then under the Properties dialog box, switching to the Parameters tab.

You can also use a macro to add parameters to an object, assign a different value to an existing parameter or retrieve the current value. In the following example, a parameter is added to the root folder of the active database.

ActiveDatabase.RootFolder.Parameters.Add "Charge", 54700

In the following example, the existing parameter is retrieved.

charge = ActiveDatabase.RootFolder.Parameters("Charge")

The following example assigns a different value to an existing parameter.

ActiveDatabase.RootFolder.Parameters("Charge") = 58000

Share article or send as email:

You might be interested in these articles