暱稱: joey0415
中學生
- 帖子
- 361
- 主題
- 57
- 精華
- 0
- 積分
- 426
- 點名
- 0
- 作業系統
- win7
- 軟體版本
- 2003,2010
- 閱讀權限
- 20
- 性別
- 男
- 註冊時間
- 2010-5-13
- 最後登錄
- 2022-12-8
|
5#
發表於 2016-3-15 13:20
| 只看該作者
回復 4# lcctno
小修改一下,應該可以- Sub 即時淨值()
- Application.ScreenUpdating = False
- Cells.Delete
- Dim E As Object, myItems As Object, myitem
- With CreateObject("InternetExplorer.Application")
- .Visible = True
- .Navigate "http://www.yuantaetfs.com/#/RtNav/Index"
-
- Application.Wait Now + #12:00:03 AM# '有錯在開啟
- Set myItems = .Document.getElementsByTagName("button")
- For Each myitem In myItems
-
- 'Application.Wait Now + #12:00:00 AM# '有錯在開啟
-
- If myitem.Name = "Agree" Then
-
- myitem.Click '按下送出查詢按鈕
- End If
- Next
- 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
- x = Cells(Rows.Count, 2).End(xlUp).Row
- For A = x To 6 Step -1
- If Cells(A, 4) = "" Then
- Rows(A).Delete
- End If
- Next
- Columns(1).Delete
- Application.ScreenUpdating = True
- End Sub
複製代碼 |
|