Ask Your Question

How to get listbox item position ? [closed]

asked 2014-04-23 07:28:35 +0100

sulliwane gravatar image

updated 2015-09-07 22:18:53 +0100

Alex Kemp gravatar image


I have a listbox in a form (ie : drawed on the spreadsheet, not in a dialog).

I use this macro to get the current value of the selected item.

oForm = ThisComponent.Sheets(0).getDrawPage().getForms().getByIndex(0) 
oListBox = oForm.getByName("myListBox")
print oListBox.CurrentValue

Now I'd like to get the position of the item as a number. I checked on this API page and tried this :

print oListBox.GetSelectedItempos

but with no success.

image description

Thank you for your ideas!

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2016-02-21 07:19:31.650430

1 Answer

Sort by » oldest newest most voted

answered 2014-04-24 07:32:00 +0100

sulliwane gravatar image

Here is how to access the position of an item in a form listbox :

items = oListBox.selectedItems
Print items(0)

credit to FJCC from

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2014-04-23 07:28:35 +0100

Seen: 2,314 times

Last updated: Apr 24 '14