title: HTML parsing of website inspect element by VBA
body: <p>I need to extract some image src data of the website. i wrote some code, but it is not working . </p>
  
  <pre><code>Sub getSrcAttributeImgTag()
      Dim ie As InternetExplorer
      Dim html As HTMLDocument
      Dim ElementCol As Object, Link As Object
      Dim ecol As Long
  
      Application.ScreenUpdating = False
  
      Set ie = New InternetExplorer
      ie.Visible = False
  
      ie.navigate "http://test.site/showadv.php?rstr=0.8809384451371399"
  
      Do While ie.readyState &lt;&gt; READYSTATE_COMPLETE
  
      Loop
  
      Set html = ie.document
      Set ElementCol = html.getElementsByTagName("img")
  
      For Each Link In ElementCol
          ecol = Worksheets("sheet1").Cells(1, Columns.Count).End(xlToLeft).Offset(0, 1).Column
          Cells(1, ecol).Value = Link.src
          Cells(1, ecol).Columns.AutoFit
      Next
  
      Set ie = Nothing
      Application.StatusBar = ""
      Application.ScreenUpdating = True
  End Sub
  </code></pre>
  
  <p>HTML As follows</p>
  
  <pre><code>  &lt;form name="mainf" onsubmit="javascript:dosub();return false;"&gt;
    &lt;div align="center"&gt;
    &lt;table&gt;
    &lt;tbody&gt;&lt;tr&gt;
    &lt;td&gt;&lt;div id="cimg1"&gt;&lt;img width="35" height="55" src="images/capchs/4.png"&gt; 
    &lt;/div&gt;&lt;/td&gt;
    &lt;td&gt;&lt;div id="cimg2"&gt;&lt;img width="35" height="55" src="images/capchs/3.png"&gt; 
    &lt;/div&gt;&lt;/td&gt;
    &lt;td&gt;&lt;div id="cimg3"&gt;&lt;img width="35" height="55" src="images/capchs/3.png"&gt; 
     &lt;/div&gt;&lt;/td&gt;
    &lt;td&gt;&lt;div id="cimg4"&gt;&lt;img width="35" height="55" src="images/capchs/5.png"&gt; 
     &lt;/div&gt;&lt;/td&gt;
    &lt;td&gt;&lt;div id="cimg5"&gt;&amp;nbsp;&lt;/div&gt;&lt;/td&gt;
   &lt;/tr&gt;
  &lt;/tbody&gt;&lt;/table&gt;
  &lt;/div&gt;&lt;br&gt;
  &lt;div align="center"&gt;
   &lt;input type="text" name="capcha" value="" 
  style="width:200px;height:30px;font-size:15px;"&gt;
  &lt;/div&gt;&lt;br&gt;&lt;br&gt;
  &lt;div align="center"&gt;
  &lt;input type="button" value="CONTINUE" style="width:200px;height:30px;font- 
  size:15px;" onclick="javascript:dosub()"&gt;
  &lt;/div&gt;&lt;br&gt;&lt;br&gt;
  &lt;div align="center"&gt;
  &lt;br&gt;
   &lt;/div&gt;&lt;br&gt;&lt;br&gt;
   &lt;/form&gt;
  </code></pre>
  
  <p>But my VBA code not working for inspect element HTML.</p>
  
  <p>the result should be in excel A ="images/capchs/5.png" etc</p>
  
  <p>Thanks in advance</p>