Hello:
I have made a good-faith attempt to search the forum for the answer but am unable to find a workable solution so please bear with me.
Here is the situation:
- I have a userform with a number of ActiveX controls: command buttons, labels, etc.
- While trying to duplicate some of them, I end up with some with the generic label CommandButton1, Label3, etc.
- I wish to delete these extraneous controls using VBA but run into a problem
My code looks like this:
![]()
Please Login or Register to view this content.
When I use the variable badControl as shown above, I get the error: "Run-time error '438': Object doesn't support this property of method"
When I use the index number (as in: MyUserForm.Controls.Remove (controlNum - 1) suggested by one forum post), I get the error: "Run-time error '444': Could not delete the controls. This method can't be used in this context"
The answer is probably quite trivial but I can't figure out what I am missing.
Thanks for your assistance.
Bookmarks