title: VBA/IE How to get past file save prompt?
body: <p>We receive emails with links to documents, or more precisely, links to webpages that contain buttons we click to download documents. I want to automate this under Office 2016, IE 11, and Windows 7 Enterprise. I've gotten this far.</p>
  
  <p><a href="https://i.stack.imgur.com/gQOPz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gQOPz.png" alt="screen shot with download button and IE prompt"></a></p>
  
  <p>In VBA, I set references to Microsoft HTML Object and Internet Controls libraries. I load the page, locate the button control on the page, and issue the button's click method. Then I get the prompt you see above. I want to save as... that is, each downloaded file will go in a particular directory. How would you do that?</p>
  
  <p>EDIT: The URL to the file is not contained in the web page's source. The code for the Download button is this:</p>
  
  <pre><code>&lt;form action="/Home/NoCaptcha" method="post"&gt;
      &lt;input type="submit" class="btn btn-primary btn-lg" value="Download" style="margin-top: 40px;" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>The prompt is not part of the webpage, so I can't use HTML to find the button. I could use SendKeys (not ideal), but even then, I could only send Alt-S to save. Is there a way of virtually clicking on the down arrow to expose the Save As option? But if I do this, how do I enter the location of the file? Would I have to somehow control the actual Save As dialog box?</p>
  
  <p>Assuming I can use SendKeys to send an Alt-S, just before doing that, I could change the registry key that holds the default download location. But this would involve writing to the registry hundreds of times per day. Are there consequences to this? Do I risk corrupting the registry?</p>
  
  <p>EDIT: <strike>I suppose if IE automatically downloaded the file, that would solve my problem too</strike> Further research uncovers that the option to download without prompts was removed since IE 10.</p>