TWiesendanger
9/7/2018 - 2:13 PM

Create Parameter

'Setting an userParameter as text parameter
oParameter=oMyParameter.AddByValue("AwesomeParameter", "Option1", UnitsTypeEnum.kTextUnits)MultiValue.SetList("AwesomeParameter", "Option1", "Option2", "Option3", "Option4")
'Setting an userParameter as text parameter
oParameter=oMyParameter.AddByValue("color", "bule", UnitsTypeEnum.kTextUnits)
oParameter=oMyParameter.AddByValue("color", "red", UnitsTypeEnum.kTextUnits)
oParameter=oMyParameter.AddByValue("color", "yellow", UnitsTypeEnum.kTextUnits)
'Setting an userParameter as Millimeteres
oParameter=oMyParameter.AddByExpression("Length_mm", "3", UnitsTypeEnum.kMillimeterLengthUnits)
oParameter=oMyParameter.AddByExpression("Width_mm", "3", "mm")
oMyParameter=ThisApplication.ActiveDocument.ComponentDefinition.Parameters.UserParameters
'Setting an userParameter as inches
oParameter=oMyParameter.AddByExpression("Length_inch", "3", UnitsTypeEnum.kInchLengthUnits)
oParameter=oMyParameter.AddByExpression("Width_inch", "3", "in")
oMyParameter=ThisApplication.ActiveDocument.ComponentDefinition.Parameters.UserParameters
'Setting an userParameter as inches
oParameter=oMyParameter.AddByExpression("Length_inch", "3", UnitsTypeEnum.kInchLengthUnits)
oParameter=oMyParameter.AddByExpression("Width_inch", "3", "in")
 
'Setting an userParameter as Millimeteres
oParameter=oMyParameter.AddByExpression("Length_mm", "3", UnitsTypeEnum.kMillimeterLengthUnits)
oParameter=oMyParameter.AddByExpression("Width_mm", "3", "mm")
 
'Setting an userParameter as text parameter
oParameter=oMyParameter.AddByValue("color", "bule", UnitsTypeEnum.kTextUnits)
oParameter=oMyParameter.AddByValue("color", "red", UnitsTypeEnum.kTextUnits)
oParameter=oMyParameter.AddByValue("color", "yellow", UnitsTypeEnum.kTextUnits)
Try
    oMyParameter= oRefDoc.ComponentDefinition.Parameters.UserParameters
    oParameter = oMyParameter.Item("Auftragsnummer")
    oParameter.Expression = Auftragsnummer 
Catch
    oParameter = oMyParameter.AddByExpression("Auftragsnummer", Auftragsnummer, UnitsTypeEnum.kUnitlessUnits)
End Try