|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Sub 按钮1_Click()
- Dim url, html
- n = 2
- url = "http://www.okooo.com/zucai/shuju/zhishu/14109/"
- Set html = CreateObject("htmlfile")
- With CreateObject("msxml2.xmlhttp")
- .Open "get", url, False
- .send
- html.body.innerhtml = StrConv(.responsebody, vbUnicode)
- Set tb = html.all.tags("table")(0).Rows
- For i = 1 To tb.Length - 1
- n = n + 1
- For j = 0 To tb(i).Cells.Length - 1
- Cells(n, j + 1) = tb(i).Cells(j).innertext
- Next
- Next
- End With
- End Sub
- Sub 按钮2_Click()
- Range("a3:p65536").ClearContents
- End Sub
复制代码 |
|