Web page data into EXCEL spreadsheet, ask for help!
Time:09-23
Web data into EXCEL spreadsheet, please grab the code! Haven't learned these knowledge, enthusiastic friends to help, thank you first!
Copy the address: http://pan.baidu.com/s/1eRTNr94 Collect web: http://www.17500.cn/pub/sjh.htm
CodePudding user response:
http://pan.baidu.com/s/1c2yZ1wk
Sub import () With HTTP url="http://www.17500.cn/pub/sjh.htm" Dim XmlHttp As Object, stime, ntime The Set XmlHttp=CreateObject (" Microsoft. XmlHttp ") XmlHttp. Open "GET", take the HTTP url, True XmlHttp. Send Stime=Now While XmlHttp. ReadyState & lt;> 4
DoEvents Ntime=Now
If DateDiff (" s ", stime, ntime) & gt; 3 Then MsgBox "under the network is not very good, try again" : the Exit Sub Wend Access to remote web source=StrConv (XmlHttp. ResponseBody vbUnicode) The Set XmlHttp=Nothing
Starting position=InStr (for remote web site source code, "3 d") + 3 End position=InStr (access to remote web site source code, "period of commissioning") Name=Mid (for remote web site source code, start and end position - starting position)
Starting position=InStr (for remote web site source code, "3 commissioning & lt;/div> & lt; Font color=red> & lt; B>" 29) + End position=InStr (for remote web site source code, & lt;"/b> & lt;/font> & lt;/a> & lt; A href=https://bbs.csdn.net/pub/sjh.htm ") Nper=Mid (for remote web site source code, start and end position - starting position)
Cells (7, 8)=stage name Cells (9, 7)=Mid (nper, 1, 1) Cells (9, 8)=Mid (nper, 2, 1) Cells (9, 9)=Mid (nper, 3, 1) End Sub