VBA query price based on stock code

Source: Internet
Author: User

Tag:vba    Web page data    

Not implemented timed refresh sub  fetch stock price () on error resume nextset regx = createobject (" VBScript.RegExp ")   ' regx. global = trueregx.pattern =  "\[" "(. *)" "," "(. *)" ", (\d+), (. *), (. *), (\d{8}). *\]"   "arr_ Stock = range (Cells (2, 1),  cells (Cells (rows.count, 1). End (Xlup). row, 1)   ' stock code array string_stock = join (Application.transpose (Arr_stock),  ",")   ' The stock code array is divided into strings https =  "http://q.jrjimg.cn/?q=cn|s&i=" https = https & string _stock &  "&c=code,name,np,pl,time,stp&o=pl,d&n=realhqxny_concept_9000&_= 1507340273905 "Set ie = createobject (" Internetexplorer.application ") ie.navigate httpsDo  Until ie.readystate = 4    DoEventsLoopWith ie.document        string_body = .body.innerText  ' returned code          Set Mh = regx. Execute (string_body)   ' Apply regular         for each m in  mh        i = i + 1                cells (i + 1, 2)  =  M.submatches (1)   ' Company name         cells (i + 1, 3)   = m.submatches (3)   ' Price         cells (i + 1, 4)  = m.submatches (4)   ' Change         cells (i + 1,  5)  = m.submatches (5)   ' Date     next     ie. Quitend withset ie = nothingset regx = nothingend sub


VBA query price based on stock code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.