暱稱: joey0415
中學生
- 帖子
- 361
- 主題
- 57
- 精華
- 0
- 積分
- 426
- 點名
- 0
- 作業系統
- win7
- 軟體版本
- 2003,2010
- 閱讀權限
- 20
- 性別
- 男
- 註冊時間
- 2010-5-13
- 最後登錄
- 2022-12-8
|
7#
發表於 2015-6-20 21:48
| 只看該作者
回復 6# chwqk - Sub SGX_NLT_1()
- Dim URL As String, shts As Worksheet
- Dim x As Variant, xi As Integer, A As Object, xlHtm
- Set shts = ActiveSheet ' '("工作表2")
- shts.Cells.Clear
- URL = "http://www.sgx.com/wps/portal/sgxweb/home/marketinfo/derivatives/Nlt"
- With CreateObject("InternetExplorer.Application")
- .Visible = True ' 是否顯示 IE
- .Navigate URL
- Do While .ReadyState <> 4 Or .Busy
- DoEvents
- Loop
- Application.Wait Now + TimeValue("00:00:06")
- xlHtm = .Document.body.innerHTML '儲存
- Set A = .Document.getElementsBytagname("table")
- For xi = 74 To 74
- .Document.body.innerHTML = A(xi).outerHTML
- .ExecWB 17, 2 ' Select All
- .ExecWB 12, 2 ' Copy selection
- With shts
- .Range("A" & .[A1048576].End(xlUp).Row + 1).Select
- .PasteSpecial Format:="HTML", Link:=False, DisplayAsIcon:=False, NoHTMLFormatting:=True
- End With
- .Document.body.innerHTML = xlHtm '還原
- Next xi
- shts.Cells.EntireColumn.AutoFit ' 自動調整欄寬
- .Quit
- End With
- End Sub
複製代碼- Sub SGX_NLT_2()
- Dim URL As String, shts As Worksheet
- Dim x As Variant, xi As Integer, A As Object, xlHtm
- Set shts = ActiveSheet ' '("工作表2")
- shts.Cells.Clear
- URL = "http://www.sgx.com/wps/portal/sgxweb_ch/home/marketinfo/derivatives/Nlt"
- With CreateObject("InternetExplorer.Application")
- .Visible = True ' 是否顯示 IE
- .Navigate URL
- Do While .ReadyState <> 4 Or .Busy
- DoEvents
- Loop
- Application.Wait Now + TimeValue("00:00:06")
- xlHtm = .Document.body.innerHTML '儲存
- Set A = .Document.getElementsBytagname("table")
- For xi = 113 To 115 Step 2
- .Document.body.innerHTML = A(xi).outerHTML
- .ExecWB 17, 2 ' Select All
- .ExecWB 12, 2 ' Copy selection
- With shts
- .Range("A" & .[A1048576].End(xlUp).Row + 1).Select
- .PasteSpecial Format:="HTML", Link:=False, DisplayAsIcon:=False, NoHTMLFormatting:=True
- End With
- .Document.body.innerHTML = xlHtm '還原
- Next xi
- shts.Cells.EntireColumn.AutoFit ' 自動調整欄寬
- .Quit
- End With
- End Sub
複製代碼 |
|