I am creating details on a Userform within VBA code as follows :
The screen works fine, but I now want to add a Command to each CommandButton that is created in this loop, just to display a new screen, but I can't figure out what to use. I tried
but I get a "Run-Time error 438, Object doesn't support this property or method" ...
How can I do this ?
Just had a thought, should I be creating xxx_Click routines for each button (or even 1 for any button & passing the parameters) ? If so, what do I call it ... what are my CommandButtons called ... oh dear, that looks like a stupid question ?!?!?!?
Code:
For A = 1 To MyUniqueNo
MyLeft = 14
UserForm3c.Frame1.ScrollBars = fmScrollBarsVertical
UserForm3c.Frame1.ScrollHeight = UserForm3c.Frame1.Height * (MyUniqueNo / 18)
Set MyButton = UserForm3c.Frame1.Controls.Add("Forms.CommandButton.1")
With MyButton
.Caption = A
.Width = 42
.Height = 18
.Left = MyLeft
.Top = MyTop
End With
MyLeft = MyLeft + 42
Next
UserForm3c.Show
The screen works fine, but I now want to add a Command to each CommandButton that is created in this loop, just to display a new screen, but I can't figure out what to use. I tried
Code:
.OnAction = "Call Update_Player"
but I get a "Run-Time error 438, Object doesn't support this property or method" ...
How can I do this ?
Just had a thought, should I be creating xxx_Click routines for each button (or even 1 for any button & passing the parameters) ? If so, what do I call it ... what are my CommandButtons called ... oh dear, that looks like a stupid question ?!?!?!?