|
- Sub GetStockDetail()
- Dim Adr$, sCode$, sDate$, r%
-
- Adr = "http://data.eastmoney.com/soft/stock/StockDetail.aspx?"
- sCode = [B3].Value
- sDate = Format([B4].Value, "yyyy-mm-dd")
- Adr = Adr & "code=" & sCode
- Adr = Adr & "&date=" & sDate
-
- With Range("A7").Resize(100, 20)
- .ClearContents
- .Borders.LineStyle = xlNone
- End With
- Set HTML = CreateObject("htmlfile")
- With CreateObject("msxml2.xmlhttp")
- .Open "get", Adr, False
- .send
- HTML.body.innerhtml = .responsetext
-
- r = 7
- Set tb = HTML.all.tags("table")(0).Rows
- For i = 0 To tb.Length - 1
- For j = 0 To tb(i).Cells.Length - 1
- Cells(i + r, j + 1) = tb(i).Cells(j).innertext
- Next
- Next
- Range(Cells(8, 1), Cells(i + r - 1, j)).Borders.LineStyle = xlContinuous
-
- r = i + 7 + 1
- Set tb = HTML.all.tags("table")(1).Rows
- For i = 0 To tb.Length - 1
- For j = 0 To tb(i).Cells.Length - 1
- Cells(i + r, j + 1) = tb(i).Cells(j).innertext
- Next
- Next
-
- '下面调整格式而已
- r = r - 1
- Range(Cells(i + r, 3), Cells(i + r, j + 1)) = Range(Cells(i + r, 2), Cells(i + r, j)).Value
- Cells(i + r, 2) = ""
- Range(Cells(r + 2, 1), Cells(i + r, j + 1)).Borders.LineStyle = xlContinuous
-
- Union(Cells(i + r, 3), Cells(i + r, 5)).NumberFormatLocal = "G/通用格式"
- End With
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|