gilad_gy



Hi,

i'm having a trouble to remove a Object....

a few strange errors occurs....


My Code uses: Me.Controls.Remove "txt1_1"

i'll be happy if you could help me with that...

thanks gilad.




Re: removing an object VBA

Andy Pope


Hi,

Can you provide more details.

What application are you using
What is Me actually refering to
What strange errors what are the numbers and descriptions.

This small example of an excel userform works for me.
It adds a textbox when you click the userform and deletes when you click the button.

Create a userform, add 1 commandbutton and then paste in the following code.

Code Snippet

Private Sub CommandButton1_Click()

Me.Controls.Remove "txt1_1"

End Sub

Private Sub UserForm_Click()

With Me.Controls.Add("Forms.Textbox.1", "txt1_1", True)
.Left = 10
.Top = 20
.Width = 50
.Text = "Hello"
End With

End Sub