Sal Paradise
Well-known Member
- Joined
- Oct 23, 2006
- Messages
- 2,457
I have two identical userforms. I want to give them different names. If the word Google appears in the UserForm, I want to swap it with Yahoo.
I figured this would work:
Unfortunately, it keeps giving me an error:
Any ideas?
I figured this would work:
Code:
Sub Test()
Dim Ctl As Control
Application.EnableEvents = False
For Each Ctl In Google.Controls
Ctl.Name = Replace(Ctl.Name, "Google", "Yahoo")
Next Ctl
Application.EnableEvents = True
End Sub
How the dickens do I get it to loop through my controls and change names? Even if I try to change a single name by code manually (Google.SearchName.Name = "YahooSearch") it doesn't do it, giving the same error.Run-time error '382':
Could not set the Name property. Can not set property at run-time.
Any ideas?