VBA: How to assign a different global variable value to each configuration and then export driven dimensions?

I am trying to automate a parametric sketch in SolidWorks using VBA.

I have:

- a global variable called `da`

- many configurations such as `da_0`, `da_1`, `da_2`, etc.

- sketch dimensions driven by equations that depend on `da`

What I want is:

1. create or loop through configurations

2. assign a different value of `da` to each configuration

3. rebuild

4. export driven dimensions for each configuration to CSV

The problem is that I can create the configurations, but when I try to set `da` by VBA, the value does not change. The sketch stays at the same state.

For example, in the Equation Manager the actual equation remains something like:

```text

"da" = 6.00

```

even though the macro is trying to set a different value.

I tried using `SetEquationAndConfigurationOption` with `swSpecifyConfigurations`, but the assigned value still does not become configuration-specific in the way I need.

Minimal snippet:

```vb

cfgNames = Array(cfgName)

eqnText = Chr\\\$(34) & "da" & Chr\\\$(34) & "= " & NumTxt(daValue)

swEqnMgr.SetEquationAndConfigurationOption gvIndex, eqnText, SW_SPECIFY_CONFIGS, cfgNames

Part.ShowConfiguration2 cfgName

Part.EditRebuild3

Part.ForceRebuild3 False

```

Questions:

1. What is the correct VBA/API pattern to assign a different global-variable value per configuration?

2. Is a global variable the wrong thing to drive here, and should I instead drive a dimension directly per configuration?

3. Once the configurations are valid, what is the best way to export driven dimensions for all configurations via VBA?


 

Any SolidWorks API example for configuration-specific global variables would help.