- 帖子
- 5923
- 主題
- 13
- 精華
- 1
- 積分
- 5986
- 點名
- 0
- 作業系統
- win10
- 軟體版本
- Office 2010
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台灣基隆
- 註冊時間
- 2010-5-1
- 最後登錄
- 2022-1-23
        
|
回復 3# espionage
不錯是要等待網頁的資料下載完畢- Option Explicit
- Sub Ex()
- Dim a As Object, stockcode
- With CreateObject("InternetExplorer.Application") '開啟證券櫃臺買賣中心網頁
- .Visible = True
- stockcode = 4111
- .Navigate "http://www.tpex.org.tw/web/stock/aftertrading/daily_trading_info/st43.php?l=zh-tw"
- Do While .Busy Or .readyState <> 4: DoEvents: Loop
- With .Document
- .getElementsByTAGName("INPUT")("input_stock_code").Value = stockcode
- '--------------------輸入要查詢的日期
- With .getElementsByTAGName("INPUT")("input_date")
- .Value = "104/06" ' yearmonth
- '*********************
- .fireEvent ("onchange") 'ie8可用
- '新版ie 請參考 http://forum.twbts.com/thread-14308-1-1.html
- '**********************
- End With
- With .getElementByID("stk_no")
- Do
- If .INNERTEXT = "請輸入股票代碼及資料年月" Then
- MsgBox "請輸入股票代碼及資料年月"
- GoTo ER
- End If
- Loop Until InStr(.INNERTEXT, stockcode)
- End With
- Set a = .getElementsByTAGName("table")
- MsgBox .getElementByID("stk_no").INNERTEXT & vbLf & a(0).outertext
- End With
- ER:
- .Quit
- End With
- End Sub
複製代碼 |
|