On 10/24/2014 07:06 PM, Vladislav Stevanovic wrote:
Hello,
Is it possible with code in Basic to access to the list of Autofilter data
in Calc? Reason: filtering with basic is limited maximum with 3 criteria...
Because I need more then 3 criteria I want with basic code to use
filtering capability of Autofilter.
Thanks in advance,
Wlada
First, Andreas is correct, you should post these types of questions to
the forum not the Dev list.
Second, I wrote a document called "Calc As A Simple Database" that is
now part of the official LibreOffice documentation that has a macro
called AddNewDatabaseRange that sets a range to use an autofilter.
If you look at OOME, available from my web site, I also demonstrate how
to create and use regular filters using macros. I expect that this is
also in the aforementioned document.
Sub AddNewDatabaseRange()
Dim oRange 'DatabaseRange object.
Dim oAddr 'Cell address range for the database range.
Dim oSheet 'First sheet, which will contain the range.
Dim oDoc 'Reference ThisComponent with a shorter name.
oDoc = ThisComponent
If NOT oDoc.DatabaseRanges.hasByName("MyName") Then
oSheet = ThisComponent.getSheets().getByIndex(0)
oRange = oSheet.getCellRangeByName("A1:F10")
oAddr = oRange.getRangeAddress()
oDoc.DatabaseRanges.addNewByName("MyName", oAddr)
End If
oRange = oDoc.DatabaseRanges.getByName("MyName")
oRange.AutoFilter = True
End Sub
--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
Info: http://www.pitonyak.org/oo.php