Error saying Control object does not have Enable property.

M

MikeAllgood

I have a subroutine that accepts a Frame object as a parameter. I am trying
to cycle through the controls in the frame to set the enable properties of
the controls based on some criteria. Here is the subroutine:

Public Sub EnableObjects(ByRef fraEnable As Frame, ByRef myCheckBox As _
CheckBox)
Dim cCtl As Control

For Each cCtl In fraEnable.Controls
If cCtl.Name <> myCheckBox.Name And TypeName(cCtl) <> "Label" And _
cCtl.Name <> "txtTalentMod1Total" Then
cCtl.enable = True <---Error happens here!
End If
Next cCtl
End Sub

When it get to the line,

cCtl.enable = True

I get an "Object doesn't support this property or method" error (Error 438).
Why would a control object not have an enable property? What am I doing wrong?

Thanks,
Mike
 
J

Jim Cone

Mike,

The first thing I see is that "enable" should be "enabled"
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)


"MikeAllgood"
wrote in message
I have a subroutine that accepts a Frame object as a parameter. I am trying
to cycle through the controls in the frame to set the enable properties of
the controls based on some criteria. Here is the subroutine:

Public Sub EnableObjects(ByRef fraEnable As Frame, ByRef myCheckBox As _
CheckBox)
Dim cCtl As Control

For Each cCtl In fraEnable.Controls
If cCtl.Name <> myCheckBox.Name And TypeName(cCtl) <> "Label" And _
cCtl.Name <> "txtTalentMod1Total" Then
cCtl.enable = True <---Error happens here!
End If
Next cCtl
End Sub

When it get to the line,

cCtl.enable = True

I get an "Object doesn't support this property or method" error (Error 438).
Why would a control object not have an enable property? What am I doing wrong?

Thanks,
Mike
 
M

MikeAllgood

Ah, my inability to edit my own spelling rears its oh so ugly head again! I
feel stupid now.

Thanks Jim!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top