I'm looking at code that links a button created on a userform at runtime with some code in a class module.
I don't understand the use of the tag property here. is it just so that if the user wants to they can extract the identity of a certain button?
Wouldn't "control.name & i" have worked for that?
For Each obj In Me.Controls
If TypeName(obj) = "CommandButton" Then
If Left(obj.Name, 3) = "dyn" Then
i = i + 1
ReDim Preserve c(i)
Set c(i) = New Class1
obj.Tag = i
Creating controls at runtime is not my forte. It may simply be a matter of taste. I guess it depends on how the tag value is used (if at all) later on - perhaps it's a convenience. Sometimes you just do what you're used to doing, even if other (better) ways exist.