PDA

View Full Version : Data Scrape from IE



dhighto
03-05-2015, 06:24 AM
Hey guys,

I'm pulling data from a web page to store into Excel. I have no problem when the data has labeled with an id, but I can't figure out code like <span title="dod" class="data">. Can anyone help a vba newbie? This is the code I'm looking at. I'm trying to pull the the DOD data (02/02/2015). I think I would use getattribute, but I'm not the greatest at writing code.


<ulclass="dod">

<li>Name: <spanclass="data"title="name"><ahref="#"class="combolink"id="comboname1_4"xxxxxxxxxxx</a></span></li>

<li>DOD: <spanclass="data"title="dod">02/02/2015</span>, Died at <spanclass="data">51</span></li>


</ul>



Thanks,

Blade Hunter
03-05-2015, 05:01 PM
I don't know if it's the "right" way but I would do:

DOD = left(Split(IEData,"title=""dod"">")(1),10)

obviously replace IEData with the variable you have the page data in.

dhighto
03-06-2015, 09:14 AM
I don't know if it's the "right" way but I would do:

DOD = left(Split(IEData,"title=""dod"">")(1),10)

obviously replace IEData with the variable you have the page data in.

I'm still confused. Is this the code you would use? What would DOD be declared as? An HTMLformelement?


DOD = left(Split(IEData,"title=""dod"">")(1),10)
Range("E" & irow) = IE.Document.getattribute("DOD").innerText



Thanks,

Blade Hunter
03-08-2015, 02:05 PM
DOD is just a string variable I am using in the example to store the results of the string manipulation.


I'm still confused. Is this the code you would use? What would DOD be declared as? An HTMLformelement?


DOD = left(Split(IEData,"title=""dod"">")(1),10)
Range("E" & irow) = IE.Document.getattribute("DOD").innerText



Thanks,