OptionButtons Collection Object

Description

A collection of all the OptionButton objects on the specified chart sheet, dialog sheet, or worksheet. Option buttons allow the user to select one of a group of options. Option buttons are usually placed within a group box control (GroupBox object). You can set the position and size of an option button. On a worksheet or chart, you can also format the border and background. The font is fixed.

Accessors

The OptionButtons collection contains all of the option buttons on a single sheet. Use the Add method to create a new option button and add it to the collection. The following example adds four option buttons to the dialog sheet named "Dialog1." The new option buttons are positioned relative to the upper-left corner of the dialog frame.


Dim df As DialogFrame
Set df = DialogSheets("dialog1").DialogFrame
With DialogSheets("dialog1").OptionButtons
    .Add df.Left + 10, df.Top + 20, 100, 10
    .Add df.Left + 10, df.Top + 40, 100, 10
    .Add df.Left + 10, df.Top + 60, 100, 10
    .Add df.Left + 10, df.Top + 80, 100, 10
End With

Use the OptionButtons method with an argument to access a single member of the collection or without an argument to access the entire collection at once. The following example creates a new group box around all the option buttons on dialog sheet one by first using the Group method to create a new GroupObject object from all of the option buttons and then using the size of the GroupObject object to create the GroupBox object.


Dim op_btns As GroupObject
Set op_btns = DialogSheets(1).OptionButtons.Group
DialogSheets(1).GroupBoxes.Add op_btns.Left, _
    op_btns.Top - 10, op_btns.Width, op_btns.Height

Properties

Accelerator Property, Application Property, Border Property, Caption Property, Count Property, Creator Property, Display3DShading Property, Enabled Property, Height Property, Interior Property, Left Property, LinkedCell Property, Locked Property, LockedText Property, OnAction Property, Parent Property, PhoneticAccelerator Property, Placement Property, PrintObject Property, Text Property, Top Property, Value Property, Visible Property, Width Property, ZOrder Property.

Methods

Add Method (Graphic Objects and Controls), BringToFront Method, Characters Method, CheckSpelling Method, Copy Method, CopyPicture Method, Cut Method, Delete Method, Duplicate Method, Group Method, Item Method, Select Method, SendToBack Method.