暱稱: joey0415
中學生
- 帖子
- 361
- 主題
- 57
- 精華
- 0
- 積分
- 426
- 點名
- 0
- 作業系統
- win7
- 軟體版本
- 2003,2010
- 閱讀權限
- 20
- 性別
- 男
- 註冊時間
- 2010-5-13
- 最後登錄
- 2022-12-8
|
2#
發表於 2016-3-13 18:58
| 只看該作者
回復 1# PKKO
- Sub ex1()
- For i = 1 To 30
-
- Cells(i, 4) = Len(Cells(i, 3))
- Cells(i, 5) = InStr(Cells(i, 3), "(")
- Cells(i, 6) = InStr(Cells(i, 3), ")")
- Cells(i, 7) = Mid(Cells(i, 3), Cells(i, 5) + 2, Cells(i, 6) - Cells(i, 5) - 3) '公司代碼
- snum = Cells(i, 7)
- Set HTML = CreateObject("htmlfile")
-
- Dim strText As String
- With CreateObject("WinHttp.WinHttpRequest.5.1")
- .Open "get", "http://www.travel.org.tw/showtable.aspx?id=" & snum, False
- .Send
- strText = .responseText
-
- HTML.body.innerhtml = strText
- Set tb = HTML.all.tags("table")(0).Rows
-
- For x = 1 To 13
- Cells(i, x + 7) = tb(x).Cells(1).innertext
- Next
- End With
- Next
-
- Cells.EntireColumn.AutoFit
- End Sub
複製代碼
test.zip (27.6 KB)
|
|