- 帖子
- 5923
- 主題
- 13
- 精華
- 1
- 積分
- 5986
- 點名
- 0
- 作業系統
- win10
- 軟體版本
- Office 2010
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台灣基隆
- 註冊時間
- 2010-5-1
- 最後登錄
- 2022-1-23
        
|
回復 10# fei6999
試試看- Option Explicit
- Sub 個別現金流量表()
- Dim Sh As Worksheet
- With CreateObject("InternetExplorer.Application")
- .Navigate "http://mops.twse.com.tw/mops/web/t164sb05"
- .Visible = True
- Do While .Busy Or .readyState <> 4: DoEvents: Loop
- With .Document
- .getElementsByTagName("input")(38).Value = "5349" '這裡修改 股票代號
- .getElementsByTagName("input")(41).Click
- End With
- Do While .Busy Or .readyState <> 4: DoEvents: Loop
-
- '******************************
- .Document.body.innerHTML = .Document.getElementsByTagName("table")(3).outerHTML
- .ExecWB 17, 2 ' Select All
- .ExecWB 12, 2 ' Copy selection
- .Quit
- End With
- '****************************
- Set Sh = Sheets(1)
- Sh.UsedRange.Clear
- With Sheets.Add(, Sheets(Sheets.Count))
- .Range("A1").Select
- .PasteSpecial Format:="HTML", Link:=False, DisplayAsIcon:=False, NoHTMLFormatting:=True
- .Range("C:D,P:P").Copy Sh.[A1]
- Application.DisplayAlerts = False
- .Delete
- Application.DisplayAlerts = True
- End With
- With Sh
- .Activate
- .Rows("1:11").Delete
- .UsedRange.EntireColumn.AutoFit
- End With
-
- End Sub
複製代碼 |
|