Programmely written code don't work
Flemming,
How about a different approach, namely to create a class module that can
handle all optionbutton controls.
First, create a class module, and name it clsOpt, with this code
Public WithEvents OptButton As MSForms.OptionButton
Private Sub OptButton_Click()
'add your specific code here
MsgBox "You clicked: " & OptButton.Caption
End Sub
Then in your userform event, add this code
Dim collOpt As Collection
Dim formButton As clsOpt
Private Sub UserForm_Initialize()
Dim oCtl As MSForms.Control
Set collOpt = New Collection
For Each oCtl In Me.Controls
If TypeOf oCtl Is MSForms.OptionButton Then
Set formButton = New clsOpt
Set formButton.optButton = oCtl
collOpt.Add formButton
End If
Next oCtl
End Sub
--
HTH
Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
"Flemming Dahl" wrote in message
...
Show/Hide dos not provide the flexiblity of how many controls the user
needs.
In this case i am not going to make alle those controls and show/hide
procedures..........
Lets stop it here. It seems that you can not provide any extra information
to solve my problem.
Thanks,
Flemming
|