html - VBA - Extracting values by tag attribute -


i have been using following code pull values web page.

private sub update()    dim ie new internetexplorer   ie.visible = false   ie.navigate "cisco.com/" & range("srnum").value       doevents   loop until ie.readystate = readystate_complete   dim doc htmldocument   set doc = ie.document   dim stag string   stag = doc.getelementbyid("caseheader").innertext    sheets.add   activecell.value = stag  end sub 

i on new page need pull value attribute "title". in example below need find attribute "title" value of "priority" , return value of "p3".

<div class="con-lfloat con-ralign con-priority width25">   <span class="con-text-bold width20 con-ralign">priority :</span>   <span class="con-text-bold con-lmargin5" title="priority">p3</span> </div> 

have tried using .item(0) or .children(0) no luck , haven't found documentation walk me through it.

i need assistance 1 or site can me set up.

-thanks

try adding this:

dim htmlele1 ihtmlelement  on error resume next each htmlele1 in doc.all     if htmlele1.getattribute("title") = "priority" debug.print htmlele1.innertext    next htmlele1 on error goto 0 

also change ie.readystate = readystate_complete ie.readystate = readystate_complete , ie.busy = false


Comments