Option Explicit
'声明对象变量为 CommandButton 。
Private WithEvents cmdObject As CommandButtonPrivate Sub Form_Load()
    '动态添加按钮
    Set cmdObject = Form1.Controls.Add("VB.CommandButton", "cmdOne")
    With cmdObject
        .Visible = True
        .Caption = "动态按钮"
        .Width = 1000
        .Height = 500
        .Top = Form1.Height / 2 - 500
        .Left = Form1.Width / 2 - 500
    End With