title: Programmatically adding a commandbutton to a userform
body: <p>In excel vba I have added a commandbutton to userform... like below</p>
  
  <pre><code>      Set ctrl = Me.Controls.Add( _
        bstrProgID:="Forms.CommandButton.1", _
        Name:="CommandButton1", Visible:=True)
  </code></pre>
  
  <p>Now I wanted to know how would I tell it what to do when it is clicked?</p>