View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Ben Ben is offline
external usenet poster
 
Posts: 509
Default delete Userform control programmatically

Thank you, appreciate the assistance

"Tom Ogilvy" wrote:

Assuming the control was added at runtime

Private Sub CommandButton1_Click()
me.Controls.Remove("textbox1")
End Sub


--
Regards,
Tom Ogilvy

"ben" wrote in message
...
K. Dales,

I must apologize to everyone, it seems my question was not specific
enough. Let me try again. I want to delete a Control off of a Userform,

not
the userform itself, and I wish to do so through VBA not in VBE in design
mode. I did find how to remove all controls, but I wish to do only one at

a
time.

"K Dales" wrote:

Geez, Ben, didn't turn out to be so easy to figure this out, but you got

me
curious so I followed the trail and found the answer: You need to add

the
VBIDE (Microsoft Visual Basic for Applications Extensibility) reference,

and
then:

ThisWorkBook.VBProject.VBComponents.Remove _
ThisWorkBook.VBProject.VBComponents("UserForm1")


"ben" wrote:

Have searched on discussion groups and not found what I am looking

for.
How do you programmatically delete a Userform control. This is one

that I
have created myself through VBA.
Ben