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 ?
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