Ask Your Question

set spin button control max value on document open [closed]

asked 2018-05-08 17:07:25 +0100

mlwn gravatar image

updated 2020-08-02 17:43:00 +0100

Alex Kemp gravatar image

I have a calc sheet, where I inserted a control (spin button). How can I set its max value from a cell value inside that sheet ?

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 2020-08-02 17:43:08.780241

1 Answer

Sort by » oldest newest most voted

answered 2018-05-08 20:41:56 +0100

Jim K gravatar image

Set the SpinValueMax attribute. Call the macro on the Open Document event.

Sub SetMaxValue
    oSheet = ThisComponent.getSheets().getByIndex(0)
    oForm = oSheet.DrawPage.getForms().getByName("Form")
    oControl = oForm.getByName("Spin Button 1")
    oCell = oSheet.getCellRangeByName("B1")
    oControl.SpinValueMax = oCell.getValue()
End Sub

Sample file: Spin Button.ods

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2018-05-08 17:07:25 +0100

Seen: 178 times

Last updated: May 08 '18