title: 'click' a website's button with excel VBA
body: <p>I have a script I am writing where I can execute a form on a website through a macro. I am able to open up internet explorer and pass all the variables correctly however when it comes time to submit, I am a bit lost.</p>
  
  <p>this is the element on the website i want to click - it is a button titled "buy"</p>
  
  <pre><code>&lt;input type="submit" name="submit" value="Buy"&gt;
  </code></pre>
  
  <p>I have two problems:</p>
  
  <p>1) i don't know how to properly reference this within vba
  2) there is a button right next to it that will perform a sell (the exact opposite of what i want to do) and the element for that is:</p>
  
  <pre><code>&lt;input type="submit" name="submit" value="Sell"&gt;
  </code></pre>
  
  <p>Does anyone know appropriate code to hit the 'buy' button?</p>
  
  <p>here is my code thus far:</p>
  
  <pre><code>Dim IE As Object
  Set IE = New InternetExplorer
  IE.Visible = True
  IE.Navigate "somewebsite.com"
  
  Do While IE.Busy: DoEvents: Loop
  Do While IE.ReadyState &lt;&gt; 4: DoEvents: Loop
  IE.Document.All("resourceoption").Value = "item"
  IE.Document.All("amount").Value = 1
  IE.Document.All("priceper").Value = 99
  Do While IE.Busy: DoEvents: Loop
  Do While IE.ReadyState &lt;&gt; 4: DoEvents: Loop
  </code></pre>