I find no single way in any documentation to archieve this:
A text document in Writer contains a contract. It also contains a basic macro with dialog where this contract can be configured. It asks for names, values, dates, and provides list boxes with predefined options to choose from. After hitting OK, the macro will
a) put the names into predefined placeholders (my way was to add a field that displays a variable)
b) switch on and off several hidden paragraphs (here, they also react on well-defined variable conditions).
So, in short, I want to access that “document variables” from my macro.
Googeling anything that should make sense led to massive amounts of useless information, also because there is no real way to distinguish variables that are defined by Insert → Fields → More Fields → Variables → Set Variable and classic variables like “Public name as String”.
I tried to record a macro where I manually edit a set-variable-field and hoped it would show me how to access it and put in a new value, but that resulting macro didn’t reflect this step.