vba - Excel Macro - Search Google for Phone number -


i build macro in excel opens google chrome , searches contents (which company names) of column f, , saves phone number of company column g. phone number of many companies pops in results. if phone number cannot found, (at least) have excel open google , search information without me having copy , past hundreds of times. also, keep system crashing or many google tabs opening, macro search selection have made... attempting implement code found below. have admit, inexperienced vba user. can give great... , apologize ignorance.

sub xmlhttp()  dim url string, lastrow long dim xmlhttp object, html object, objresultdiv object, objh3     object, link object  dim start_time date  dim end_time date  lastrow = range("f" & rows.count).end(xlup).row  dim cookie string dim result_cookie string  start_time = time debug.print "start_time:" & start_time  = 2 lastrow     url = "https://www.google.co.in/search?q=" & cells(i, 1) & "&rnd=" & worksheetfunction.randbetween(1, 10000)     set xmlhttp = createobject("msxml2.serverxmlhttp")   xmlhttp.open "get", url, false   xmlhttp.setrequestheader "content-type", "text/xml"   xmlhttp.setrequestheader "user-agent", "mozilla/5.0 (windows nt 6.1; rv:25.0) gecko/20100101 firefox/25.0"   xmlhttp.send    set html = createobject("htmlfile")   html.body.innerhtml = xmlhttp.responsetext   set objresultdiv = html.getelementbyid("rso")   set objh3 = objresultdiv.getelementsbytagname("h3")(0)   set link = objh3.getelementsbytagname("a")(0)     str_text = replace(link.innerhtml, "<em>", "")   str_text = replace(str_text, "</em>", "")    cells(i, 2) = str_text   cells(i, 3) = link.href   doevents next  end_time = time debug.print "end_time:" & end_time  debug.print "done" & "time taken : " & datediff("n", start_time, end_time) msgbox "done" & "time taken : " & datediff("n", start_time, end_time) end sub 


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -