title: Two IE windows being opened by VBScript, but should only be one
body: <p>I have a VBScript that pings some server and outputs results (full code in this <a href="http://pastebin.com/kenUXybK" rel="nofollow">Pastebin</a>). Part of the script shows an IE window with a 'Please Wait' message in, but for some reason two IE windows are opened (and populated as I wish by the below code), yet only one is closed when I <code>Quit</code> at the end of the script.</p>
  
  <p>Here is the function that is causing me troubles. It seems that the first line (<code>objExplorer.Navigate</code>) is opening a window as requested, but before that <code>Set objExplorer = CreateObject("InternetExplorer.Application")</code> is also opening a window.</p>
  
  <p>Does anybody know how I can stop this happening? Thanks.</p>
  
  <pre><code>' Display the progress box
  Set objExplorer = CreateObject("InternetExplorer.Application")
  
  display_progress(objExplorer)
  main() ' Do stuff, see Pastebin for full code
  close_progress(objExplorer)
  output_results() ' Show user the results, see Pastebin for full code
  
  Private Function display_progress(objExplorer)
  
      objExplorer.Navigate "about:blank"
      objExplorer.ToolBar = 0
      objExplorer.StatusBar = 0
      objExplorer.Left = 600
      objExplorer.Top = 374
      objExplorer.Width = 400
      objExplorer.Height = 152
      objExplorer.Visible = 1
  
      Dim strText, strButton
  
      strText = "&lt;div id=""text""&gt;&lt;p&gt;Please wait, servers are being pinged.&lt;/p&gt;&lt;p&gt;Results will be displayed as soon as they are ready.&lt;/p&gt;&lt;/div&gt;"
      strButton = "&lt;div id=""buttons""&gt;&lt;input type=""button"" name=""submit"" value=""Cancel"" onclick=""window.open('', '_self', ''); window.close();"" /&gt;&lt;div class=""clear""&gt;&lt;/div&gt;&lt;/div&gt;"
  
      objExplorer.Document.Body.Style.Font = "11pt 'Halvetica'"
      objExplorer.Document.Body.Style.Cursor = "wait"
      objExplorer.Document.Title = "Server ping script"
      objExplorer.Document.Body.InnerHTML = strStyle &amp; strText &amp; strButton    
  
  End Function
  
  Private Function close_progress(objExplorer)
  
      objExplorer.Document.Body.Style.Cursor = "default"
      objExplorer.Quit
  
  End Function
  </code></pre>