für Zelle A1 im aktiven Tabellenblatt:
Code: Alles auswählen
Sub Validate()
Dim oCel As Object
Dim oValidation As Object
oCel = ThisComponent.getCurrentController.getActiveSheet.getCellRangeByName( "A1" )
oValidation = oCel.getPropertyValue("Validation")
With oValidation
.Type = com.sun.star.sheet.ValidationType.LIST
.setFormula1("""abc"";""def"";""ghi""")
.ShowList = com.sun.star.sheet.TableValidationVisibility.SORTEDASCENDING
.ShowErrorMessage = True
.ErrorAlertStyle = com.sun.star.sheet.ValidationAlertStyle.STOP
End With
oCel.setPropertyValue("Validation", oValidation)
End Sub
Darin kannst Du nun die Liste in Zeile:
Code: Alles auswählen
.setFormula1("""abc"";""def"";""ghi""")
Gruß
Stephan