ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Error saying Control object does not have Enable property. (https://www.excelbanter.com/excel-programming/407455-error-saying-control-object-does-not-have-enable-property.html)

MikeAllgood

Error saying Control object does not have Enable property.
 
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


Jim Cone

Error saying Control object does not have Enable property.
 
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


MikeAllgood

Error saying Control object does not have Enable property.
 
Ah, my inability to edit my own spelling rears its oh so ugly head again! I
feel stupid now.

Thanks Jim!

"Jim Cone" wrote:

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




All times are GMT +1. The time now is 06:03 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com