- 帖子
- 142
- 主題
- 18
- 精華
- 0
- 積分
- 160
- 點名
- 274
- 作業系統
- win10 64位元
- 軟體版本
- office2003
- 閱讀權限
- 20
- 性別
- 男
- 來自
- 臺灣 高雄市
- 註冊時間
- 2015-7-18
- 最後登錄
- 2026-10-11
         
|
本帖最後由 lcctno 於 2016-3-15 09:38 編輯
這是即時淨值VBA 剛剛漏了寫 麻煩高手幫我修正成可正常使用的EXCELL表格
Sub 即時淨值()
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
End Sub |
|