Spinner Object

Description

Represents a spinner, which is often linked to edit boxes so that the user can select a numeric value without having to type in a number. Spinners are very similar to scroll bars (ScrollBar object), but spinners do not have the LargeChange property.

Edit boxes do not have spinners by default. If you want an edit box to have a spinner, you must create a separate Spinner object and add the Visual Basic code to link the spinner value to the edit box. The following example links the value of the spinner named "spnTest" to the text displayed in the edit box named "edtTest," so that changing the value of one control simultaneously changes the value of the other.


Sub spnTest_Change()
    ActiveDialog.EditBoxes("edtTest").Text = _
        ActiveDialog.Spinners("spnTest").Value
End Sub

Sub edtTest_Change()
    ActiveDialog.Spinners("spnTest").Value = _
        ActiveDialog.EditBoxes("edtTest").Text
End Sub

Accessors

The Spinner object is a member of the Spinners collection. The Spinners collection contains all the Spinner objects on a single sheet. Use the Add method to create a new spinner and add it to the collection.

To access a single member of the collection, use the Spinners method with the index number or name of the spinner as an argument.

The following example sets the OnAction property for spinner one on the worksheet named "Sheet1." The SpinnerProc Visual Basic procedure runs when the user clicks the spinner.


Worksheets("sheet1").Spinners(1).OnAction = "SpinnerProc"

The spinner name is shown in the Name Box when the spinner is selected. Use the Name property to set or return the spinner name. The following example disables the spinner named "Spinner 5" on the worksheet named "Sheet1."


Worksheets("sheet1").Spinners("spinner 5").Enabled = False

Properties

Application Property, BottomRightCell Property, Creator Property, Display3DShading Property, Enabled Property, Height Property, Index Property, Left Property, LinkedCell Property, Locked Property, Max Property, Min Property, Name Property, OnAction Property, Parent Property, Placement Property, PrintObject Property, SmallChange Property, Top Property, TopLeftCell Property, Value Property, Visible Property, Width Property, ZOrder Property.

Methods

BringToFront Method, Copy Method, CopyPicture Method, Cut Method, Delete Method, Duplicate Method, Select Method, SendToBack Method.