title: VBA to read dimensions of Images from a list of webpages
body: <p><strong>My Goal:</strong>
  I have a list of 14K URLs in a column in a worksheet.
  Each of those URLs have an image in them. Something like a site banner.
  I want to retrieve each of those banner image's dimensions into another column in the same sheet.</p>
  
  <p>Can someone tell me if this is even possible in Excel VBA.</p>
  
  <p>I have tried some things but all that is like beating around the bush and not straight forward.</p>
  
  <p>I have tried to get the image's URLS . Then download those URLS to the HDD using <a href="http://www.vb-helper.com/howto_download_url_to_file.html" rel="nofollow">'URLDownloadToFile'</a>. Then I get run some more code to get the dimensions.</p>
  
  <h2><strong>Update: Sep/15/2014 04:10 PM EST</strong></h2>
  
  <p>This is what I did:
  I use this code in sheet 1 to load the URLs (from column A) and retrieve banner image URLs in column B</p>
  
  <pre><code>Private Sub GetEm_Click()
  Dim ImageURL
  Dim PageURL
  
  Dim IE As New InternetExplorer
  IE.Visible = True
  
  For RowIndex = 0 To 15000
      pURL = Sheet1.Range("A" &amp; i).Value
  
      On Error Resume Next
      IE.Navigate pURL
  
      Do
          DoEvents
      Loop Until IE.readyState = READYSTATE_COMPLETE
  
      Dim Doc As HTMLDocument
      Set Doc = IE.document
  
      URL = Doc.getElementsByTagName("img")(1).src
      Sheet1.Range("B" &amp; i).Select       'I select and then populate the result value so that i can see the rows scrolling. This will give me an idea that the macro is still running.
          Sheet1.Range("B" &amp; i).Value = URL
  Next i
  IE.Quit
  End Sub
  </code></pre>
  
  <p><strong>The problem with this above code is that after around 150 rows, IE stops responding and my code hangs.</strong></p>
  
  <p>If this works, my plan then is to download the images using the image URLs from column B:
  For this, as stated earlier I use:
  <a href="http://www.vb-helper.com/howto_download_url_to_file.html" rel="nofollow">'URLDownloadToFile'</a></p>
  
  <p>Then once I have downloaded them, I run a vb script to get their dimensions.</p>
  
  <p>I am hoping there is a better straight forward way of doing this.</p>