HighAndWilder
Well-known Member
- Joined
- Nov 4, 2006
- Messages
- 808
- Office Version
- 365
- Platform
- Windows
I'd like to be able to change the value of a userform control property by using a variable to hold the property name.
It seems that I can used the .Properties method for the userform but not for a control on the userform.
I get an error on the highlighted line.
Object doesn't support this property or method (Error 438)
This is just to demo the method.
Is there a way to do this or is it not possible?
Thanks
It seems that I can used the .Properties method for the userform but not for a control on the userform.
I get an error on the highlighted line.
Object doesn't support this property or method (Error 438)
This is just to demo the method.
Is there a way to do this or is it not possible?
Thanks
VBA Code:
Private Sub subChangePropertyValue(strControl As String, strProperty As String, varValue As Variant)
Dim ctrl As Control
Set ctrl = Me.Controls(strControl)
[B] ctrl.Properties(strProperty).Value = varValue[/B]
End Sub
Private Sub cmdButton_Click()
Call subChangePropertyValue("cmdButton", "Top", Me.cmdButton.Top + 10)
End Sub