AN EXAMPLE: 'add a commandbutton whose name is "newbutton"and index is 0,visiable is false
Option Explicit
Private Sub Form_Click()
addcmdline
End Sub
Sub addcmdline()
Me.WindowState = 2
On Error Resume Next
Dim i As Long
For i = 0 To 99
Load newbutton(i)
newbutton(i).Left = (i Mod 10) * 1000 + 1050
newbutton(i).Top = (i \ 10) * 500 + 550
newbutton(i).Caption = "cmd" & i
newbutton(i).Width = 900
newbutton(i).Height = 400
newbutton(i).Visible = True
Next
Me.ForeColor = vbRed
Me.DrawWidth = 3
For i = 0 To 10
Me.Line (1000, 500 + i * 500)-(11000, 500 + 500 * i)
Me.Line (1000 + i * 1000, 500)-(1000 + 1000 * i, 5500)
Next
End Sub
Private Sub newbutton_Click(Index As Integer)
MsgBox " You have clicked " & newbutton(Index).Caption, 64
End Sub