' 以下代码可以自动生成两个按钮,仅供参考。 Option Explicit Dim WithEvents Command1 As CommandButton Dim WithEvents Command2 As CommandButton Private Sub Form_Load() ' 创建控件 Dim i As Integer, obj As Object Me.Caption = "创建按钮" Set Command1 = Controls.Add("VB.CommandButton", "Command1", Form1) With Command1 .Visible = True .Width = 400 .Height = 400 .Left = 0 .Top = 0 .Caption = "1" End With Set Command2 = Controls.Add("VB.CommandButton", "Command2", Form1) With Command2 .Visible = True .Width = 400 .Height = 400 .Left = 400 .Top = 0 .Caption = "2" End With End Sub