Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Control Array

Status
Not open for further replies.

anastasia

Programmer
Dec 13, 2000
111
GB
Hi,

I am trying to create a control array, using a Vb form in the VB editor in Word.

I am using option buttons and trying to give them thesame name to create a control array, but instead of VB asking me if I would like to create a control array as it does in normal VB I only get is Ambiguous name?.

I take it then I cannot create a contol array in Word on a form?. Why is this?.

The reason I need this is to distinguish which option button the user selects from a few, so that I can save this then to a database.
 
Not sure about Word but in excel, you can group optionbuttons in a frame and then use the Frame's "value" to determine which optionbutton is on
ie
op1 frame value is 1
op2 frame value is 2
op3 frame value is 3
etc etc
then test the frame's value to see which option button is selected
HTH
Geoff
 
VBA will not allow you to create control arrays but you can always do something like this to control each command button.

suppose you have 10 command buttons, and assuming it is in the furrent form.

For x = 1 To 10
CommandStr = "Command" & x
With me.Controls(CommandStr)
.Caption = CommandStr
End With
Next x

Hope this will help you!!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top