Thanks very much, I've already use the set instruction but still got a problem. In this code I create the control arrays:
In a module:
Public frames() As Control, txtbox() As Control
Private Sub UserForm_Initialize()
Dim co As Control, txt As Control
numFrames = 1
For Each co In Me.datos.Controls
If TypeName(co) = "Frame" Then
ReDim frames(1 To numFrames)
ReDim txtbox(1 To 2, 1 To numFrames)
Set frames(numFrames) = co
j = 1
For Each txt In co.Controls
If TypeName(txt) = "TextBox" Then
Set txtbox(j, numFrames) = txt
j = j + 1
End If
Next txt
numFrames = numFrames + 1
End If
Next co
arreglo_frames = Split("0,0,0,0,0,0,0", ",")
habilitar arreglo_frames
End Sub
Then, in the following habilitar subroutine I got an error that says something like "object variable or With block not established" on the line "frames(i).Enabled = True" on the first iteration of the For.
Public Sub habilitar(ByRef fs() As String)
Dim i, j, n As Integer
n = UBound(fs)
For i = 1 To n
If fs(i) = "1" Then
frames(i).Enabled = True
Else
frames(i).Enabled = True
For j = 1 To 2
txtbox(j, i).Value = 0
Next j
frames(i).Enabled = False
End If
Next i
End Sub
I don't think the problem is on the creation of the arrays because the same line inside the Userform_Initialize sub worked fine.
Thanks again