|
本帖最后由 guodong321654 于 2024-1-3 08:04 编辑
提取网址
网址利民股份(002734)成交明细_财经_凤凰网 http://app.finance.ifeng.com/dat ... 3.php?code=sz002734
Exsel 2003版
Sub CJMX()
Dim VBt, YB
Dim Wb
Set VBt = GetObject(, "Excel.Application")
Set YB = VBt.ActiveSheet
Set Wb = VBt.ThisWorkbook
Dim sp
Dim DD
Dim Arr(15000, 5), Num&
Dim url, ul, html, tb, i&, j&, k&, dm, iRow
dm = Wb.Sheets("个研").[i1].Value
If Len(CStr(dm)) <> 6 Or IsNumeric(dm) = False Then Exit Sub
If Left(dm, 1) = "6" Then dm = "sh" & dm Else dm = "sz" & dm
url = "http://app.finance.ifeng.com/data/stock/stock_item3.php?"
url = url & "code=" & dm
url = url & "&page="
Wb.Sheets("个研").[a2:e9999] = "": Wb.Sheets("个研").[L1] = "获取中..."
Set html = CreateObject("htmlfile")
iRow = 2: Num = 1
With CreateObject("msxml2.xmlhttp")
For k = 1 To 100
ul = url & k
.Open "get", ul, False
.send
html.body.innerhtml = StrConv(.ResponseBody, vbUnicode)
Set tb = html.All.tags("table")(3).Rows
For i = 1 To tb.Length - 1
For j = 0 To tb(i).Cells.Length - 1
If IsNumeric(Left(tb(i).Cells(0).innertext, 1)) = False Then Wb.Sheets("个研").[L1] = "": Wb.Sheets("个研").Cells(iRow, 1).Resize(Num, 7) = Arr: Exit Sub
Arr(Num, j + 1) = tb(i).Cells(j).innertext
Next
Num = Num + 1
Next
Next
End With
Wb.Sheets("个研").[L1] = ""
End Sub
|
|