Consulting

Results 1 to 4 of 4

Thread: Data Scrape from IE

  1. #1

    Data Scrape from IE

    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,

  2. #2
    VBAX Contributor
    Joined
    May 2010
    Location
    Sydney, NSW, Australia
    Posts
    170
    Location
    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.

  3. #3
    Quote Originally Posted by Blade Hunter View Post
    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,

  4. #4
    VBAX Contributor
    Joined
    May 2010
    Location
    Sydney, NSW, Australia
    Posts
    170
    Location
    DOD is just a string variable I am using in the example to store the results of the string manipulation.

    Quote Originally Posted by dhighto View Post
    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,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •