I want to make a list box that receives “a1: b10” from the “report” worksheet and shows the two columns in the list box, I’m trying with the code below
Dim oDialogo3 As Object
Dim vListBox As Object
Sub AtualizaListBox
Dim oSheet As Object
Dim oRange As Object
Dim i As Integer
Dim s As String
vListBox = oDialogo3.GetControl("ListBox1")
oSheet = ThisComponent.Sheets.getByName("RELATORIO")
oRange = oSheet.getCellRangeByName("A1:B10").RangeAddress
If vListBox.ItemCount > 0 Then vListBox.removeItems(0, vListBox.ItemCount)
For i = 0 To oRange.EndRow - oRange.StartRow
s = oSheet.getCellByPosition(oRange.StartColumn, oRange.StartRow + i).String
vListBox.addItem(s, i)
Next i
End Sub