title: How to programmatically click an ActiveX button in another workbook?
body: <p>I have a workbook <code>Wbk1</code> where a sheet has an ActiveX button.  I want to run the button's associated Sub from another workbook,<code>Wbk2</code>.  It's not practical to just copy the Sub's code into <code>Wbk2</code> because it in turn calls a bunch of functions from <code>Wbk1</code>.  I tried the following:</p>
  
  <pre><code>Sub pushButton()
  
  Dim obj As OLEObject
  Dim btn As MSForms.CommandButton
  
  For Each obj In Wkb1.Sheets("testSheet").OLEObjects
    If TypeOf obj.Object Is MSForms.CommandButton Then
      set btn=obj.Object
      debug.print btn.Caption 'used to test whether or not For loop is picking up button
      obj.Activate
      SendKeys " "
    End If
  Next
  
  End Sub
  </code></pre>
  
  <p>It's not only an inelegant <code>SendKeys()</code> hack, but it doesn't work; the button gets focus but it doesn't get pushed.  I know that the For loop is correctly iterating through the objects, including the CommandButton, because I can pick up the caption for the button.  How can I click on this button (and thereby run its private Sub) from <code>Wbk2</code>?</p>
  
  <p>EDIT: The actual filename in question is in the format 123A_1.0-2.0.xlsm. I think the periods are causing some trouble with regard to the solutions posted in comments and responses below, because when I remove the periods these techniques are successful.</p>