Form List Box Value

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
richjsmith
Posts: 5
Joined: Mon Apr 14, 2008 2:42 pm

Form List Box Value

Post by richjsmith »

Hello,
I have had a search and cannot find a solution. I am writing a macro that looks at the selected value of the listbox and then puts a number in a cell in calc.
I have almost got it, but I am unsure on what code to use to see what the listbox value is, I have tried .value but that doesnt work.
If anyone has any ideas that would be great

here is my code so far:

Code: Select all

Dim Doc as Object
Dim Sheet as Object
Dim Cell as Object
Dim DrawPage as Object
Dim Form As Object
Dim Ctl as Object

Doc = ThisComponent
Sheet = Doc.Sheets.getByName("Sheet 1")
DrawPage = Sheet.DrawPage
Form = DrawPage.Forms.GetByIndex(0)
Ctl = Form.getByName("Tmcb")
Cell = Sheet.getCellByPosition(37,29)

If Ctl.Value = 12 THEN
Cell = Sheet.getCellByPosition(36,29)
Cell.Value = 1380
Else
If Ctl.Value = 16 THEN
Cell = Sheet.getCellByPosition(36,29)
Cell.Value = 1924
End IF
End IF
thanks
Richard
Post Reply