title: vbscript - how to send keystrokes to internet explorer
body: <p>I've read every question that came up when I typed my title, as well as several other web pages, and I still haven't found the answer I'm looking for. I believe this is fairly straightforward, just must be missing something as my program doesn't do anything.</p>
  
  <p>Here's what I want it to do (for all practical purposes, let's say I'm searching for my favorite discussion here on SO):</p>
  
  <ul>
  <li>Have the main SO page loaded (stackoverflow.com/).</li>
  <li>Utilize the Open File (CTRL+O) feature of IE to enter the specific address of the page I'm looking for.</li>
  <li>Utilize the Select All (CTRL+A) feature to highlight the entire text to be copied.</li>
  <li>Utilize CTRL+C and CTRL+V to, respectively, copy and paste this into a word document for presentation purposes.</li>
  </ul>
  
  <p>Here's the code I have so far:</p>
  
  <pre><code>' Sets up the objects.
  Dim objIE, WshShell, objWord
  
  Set wshShell = WScript.CreateObject ("WSCript.shell") 
  Set objIE = CreateObject("InternetExplorer.Application")
  Set objWord = Application.CreateObject("Word.Application")
  
  Dim i, strUserID
  
  with CreateObject("InternetExplorer.Application")
  wshShell.SendKeys "^O"
  .navigate "http://stackoverflow.com/questions/[link of question would go here]"
  wshShell.SendKeys "^A"
  wshShell.SendKeys "^C"
      AppActivate ("Document1 - Microsoft Word")
  wshShell.SendKeys "^V"
  end with
  </code></pre>
  
  <p>For some reason, this isn't working the way I want it to. Any suggestions?</p>