https://bugs.documentfoundation.org/show_bug.cgi?id=97450

            Bug ID: 97450
           Summary: Validation created by a Macro shows Err508 but after
                    opening the Validation dialog and submitting it the
                    cells shows the expected list
           Product: LibreOffice
           Version: 4.2.8.2 release
          Hardware: x86-64 (AMD64)
                OS: Linux (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Calc
          Assignee: [email protected]
          Reporter: [email protected]

"Cell range" type Validation was created for cellsE2-E11 by a Macro and these
cells shows an "Err:508" instead of the expected value list.
But if the Validity panel is opened in any of cellsE2-E11
(Menu/Data/Validity...) and clicked OK, then the cells shows the expected value
list.

Speculation.
There are some errors in the formula or in other properties of Validation
filled up by the Macro, and the Validity panel corrects it.

Here is the Macro:

sub validity3
Dim Doc As Object
Dim Sheet As Object
Dim Cell As Object
Dim oRow As Integer
Dim oRow2 As Integer
Dim oFormula as String

Doc = ThisComponent
Sheet1 = Doc.Sheets(0)
for oRow = 1 to 10
    Cell = Sheet1.getCellByPosition(4 ,oRow)
    oProps = Cell.Validation
    oProps.Type = com.sun.star.sheet.ValidationType.LIST
    oProps.IgnoreBlankCells = True
    oProps.ShowErrorMessage = True
    oProps.ErrorMessage = "Must be a value from the list!"
    oProps.ErrorTitle = "ERROR"
    oProps.ShowInputMessage = False
    oProps.ErrorAlertStyle = com.sun.star.sheet.ValidationAlertStyle.WARNING
    oRow2 = oRow +1
       oFormula =  "IF($D$" & oRow2 & "=sub.$A$1 ,sub.$A$2:$A$12, " _
                    & "IF($D$" & oRow2 & "=sub.$B$1 ,sub.$B$2:$B$11, " _
                    & "IF($D$" & oRow2 & "=sub.$C$1 ,sub.$C$2:$C$8, " _
                    & "IF($D$" & oRow2 & "=sub.$D$1 ,sub.$D$2:$D$6, " _
                    & "IF($D$" & oRow2 & "=sub.$E$1 ,sub.$E$2:$E$4, " _
                    & "IF($D$" & oRow2 & "=sub.$F$1 ,sub.$F$2:$F$3  " _
                    & ", sub.$G$1))))))" 

    oProps.Formula1 = oFormula
    Cell.Validation = oProps

 next

end sub

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to