Re: Passing an object name through a variable
1. Declare an object variable of the type required.
2. Declare a generic object variable of the type "Object"
3. Declare a variant type variable.
Here's samples of how to do it:
Private Sub Command3_Click()
Dim oT As TextBox
Set oT = Text1
oT.Text = "TextBox"
Private Sub Command1_Click()
Dim o As Object
Set o = Text1
o.Text = "Object"
Private Sub Command2_Click()
Dim v As Variant
Set v = Text1
v.Text = "Variant"
You can also pass the object to a Sub or Function:
Private Sub PassTextBox( oT as TextBox)
Private Sub Command4_Click()
Please note that while I'm using a Textbox control as an object to pass
around inside the project, you can't pass the same to an Active X DLL (I
assume but haven't tried the same in a control). This is because VB wraps
controls inside its own extender library. You get a Type Mismatch Error (13)
if you try to.
Snip wrote in message <email@example.com>...
>I need to be able to pass the name of an object into a variable and the use
>the variable to alter that objects properties...
>Variable1 = ActMod1.Name
>Variable1.value = 15
>variable1.ID = 0012
>Does anyone know how to do this???
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center