Ändert den Wert einer Variablen und aktualisiert die Ansicht
Sub ChangeVariable(oDocument as object,Variable,NewContent as String)
Dim Var as String
Dim oTextfieldMaster As Object
Dim oPropSet as Object
Dim oDependentTextFields as Object
Dim oXDependentTextField as Object
Dim oTextFields as Object
On Error Resume Next
Var ="com.sun.star.text.FieldMaster.SetExpression."+Variable
oTextfieldMasters = oDocument.getTextFieldMasters()
oPropSet = oTextfieldMasters.getByName(Var)
oDependentTextFields = oPropSet.DependentTextFields
oXDependentTextField = oDependentTextFields(0)
oldValue = oXDependentTextField.Content
oXDependentTextField.setPropertyValue("Content", Newcontent)
oTextFields = oDocument.getTextFields()
oTextFields.refresh()
On Error Goto 0
End Sub