Ask Your Question
0

set spin button control max value on document open

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

mlwn 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 close merge delete

1 Answer

Sort by » oldest newest most voted
2

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
Login/Signup to Answer

Question Tools

1 follower

Stats

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

Seen: 88 times

Last updated: May 08 '18