title: How to read text from an already open webpage using VBA
body: <p>I have made a macro to read text from a saved html page/file. I now need to make it more advance by reading an already open webpage. would really appreciate the help</p>
  
  <p>Need to replace the line</p>
  
  <pre><code>URL = "file:///C:/test.html"
  </code></pre>
  
  <p>with something that will read an open webpage. I can make sure that there is only one tab open. I'm using the latest IE</p>
  
  <pre><code>Dim URL As String
  Dim Data As String
  
  URL = "file:///C:/test.html"
  
  Dim ie As Object
  Dim ieDoc As Object
  
  Set ie = CreateObject("InternetExplorer.Application")
  ie.navigate URL
  
  Do Until (ie.readyState = 4 And Not ie.Busy)
      DoEvents
  Loop
  
  Set ieDoc = ie.Document
  
  Data = ieDoc.body.innerText
  </code></pre>