Try this:
Private WithEvents Command2 As CommandButton
Private Sub Command1_Click()
Set Command2 = Form1.Controls.Add("VB.CommandButton", "Command2")
Command2.Visible = True
Command2.Caption = "Click Me"
Command2.Top = 100
Command2.Left = 100
End Sub
Private Sub Command2_Click()
MsgBox "I've been clicked"
End Sub
"Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'."