title: Automatically Confirming a Msgbox in Excel VBA code
body: <p>I am using ruby a WIN32OLE to automate execution of Excel macros with windows scheduler.</p>
  
  <p>I have all of this working properly. My problem comes with having to run a macro embedded in an excel file of an external party (ie I don't have control of the macro). I can call the macro with no problem, however the code contains user prompts (in the form of <code>Msgbox</code> statements)</p>
  
  <p>In short how do I tell the <code>msgbox</code> "yes" or "ok" via WIN32OLE?</p>
  
  <p>What I have tried</p>
  
  <ul>
  <li>Event handling: The Msgbox does not throw a worksheet event. I would have to think that windows throws an event somewhere for the Msgbox (but I am not skilled enough to capture it with WIN32OLE)</li>
  </ul>
  
  <p>-Threading and Sendkeys: I was also unable to get the msgbox to respond to sendkeys. More problematic was that I was unable to get the threading to work with the WIN32OLE object (it worked fine when I was using puts and sleeps to simulate the macro running.)</p>
  
  <p>It appears I am stuck with copying the code into another workbook and removing the msgbox statments, I don't really want to do that because then it will add maintenance work everytime the business logic of the 3rd party code changes.</p>