- 帖子
- 5923
- 主題
- 13
- 精華
- 1
- 積分
- 5986
- 點名
- 0
- 作業系統
- win10
- 軟體版本
- Office 2010
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台灣基隆
- 註冊時間
- 2010-5-1
- 最後登錄
- 2022-1-23
        
|
2#
發表於 2013-12-27 16:07
| 只看該作者
回復 1# blue2263
試試看- Option Explicit
- Sub 公開資訊網頁()
- Dim A As Object, E As Object
- With CreateObject("InternetExplorer.Application")
- .Visible = True
- ' .Navigate "http://mops.twse.com.tw/mops/web/t164sb04" '網址:綜合損益表
- .Navigate "http://mops.twse.com.tw/mops/web/stapap1" '網址:董監事持股餘額明細資
- Do While .ReadyState <> 4 Or .Busy: DoEvents: Loop
- .document.getElementById("isnew").Value = "false" '選擇: 歷史資料
- '註解上一行程式碼為 -> 選擇: 最新資料,不會執行 If 內程式碼
-
- If .document.getElementById("isnew").Value = "false" Then
- .document.getElementById("isnew").FireEvent ("onchange")
- .document.getElementById("year").Value = "102" '年度
- '.document.getElementById("season").Value = "01" '綜合損益表:第1季(季別)
- .document.getElementById("month").Value = "08" '董監事持股餘額明細資料:月份
- End If
- '********************************************************************
- For Each A In .document.getelementSbyTAGNAME("INPUT")
- If A.Name = "co_id" Then A.Value = "2303" '股票代號
- If A.Value = " 搜尋 " Then A.Click '按下 搜尋
- Next
- Do While .ReadyState <> 4 Or .Busy: DoEvents: Loop
- For Each E In .document.ALL.TAGS("div")
- If E.ID = "table01" Then
- .document.body.innerHTML = E.outerHTML
- .ExecWB 17, 2 ' Select All
- .ExecWB 12, 2 ' Copy selection
- With ActiveSheet
- .Cells.Clear
- .Cells(1).Select
- .PasteSpecial Format:="HTML"
- End With
- End If
- Next
- .Quit '關閉 IE
- End With
- End Sub
複製代碼 |
|