10.3.14 GetVariable
Liest den Wert einer Variablen eines Textdokumentes aus.

Function GetVariable(oDocument as object,Variable) 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)
  GetVariable= oXDependentTextField.Content
  On Error Goto 0
End Function