- 帖子
- 41
- 主題
- 0
- 精華
- 0
- 積分
- 79
- 點名
- 0
- 作業系統
- win7
- 軟體版本
- 2010
- 閱讀權限
- 20
- 性別
- 男
- 註冊時間
- 2014-4-1
- 最後登錄
- 2016-2-17
|
24#
發表於 2015-7-19 17:50
| 只看該作者
我不太會用回復,再試看看 - Option Explicit
- Sub Ex()
- Dim E As Object, myItems As Object, myitem
- With CreateObject("InternetExplorer.Application")
- .Visible = True
- .Navigate "http://www.yuantaetfs.com/#/RtNav/Index"
- Do While .Busy Or .readyState <> 4: DoEvents: Loop
- 'Application.Wait Now + #12:00:01 AM# '有錯在開啟
- Set myItems = .Document.getElementsByTagName("button")
- For Each myitem In myItems
- If myitem.Name = "Agree" Then
- myitem.Click '按下送出查詢按鈕
- End If
- Next
- Application.Wait Now + #12:00:01 AM#
- Set E = .Document.getElementsByTagName("TABLE")(21)
- .Document.body.innerHTML = E.outerHTML
- .ExecWB 17, 2 ' Select All
- .ExecWB 12, 2 ' Copy selection
- With ActiveSheet
- .Cells.Clear
- .[A1].Select
- .PasteSpecial Format:="HTML", Link:=False, DisplayAsIcon:=False, NoHTMLFormatting:=True
- End With
- .Quit '關閉網頁
- End With
- End Sub
複製代碼 |
|