- 帖子
- 5923
- 主題
- 13
- 精華
- 1
- 積分
- 5986
- 點名
- 0
- 作業系統
- win10
- 軟體版本
- Office 2010
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台灣基隆
- 註冊時間
- 2010-5-1
- 最後登錄
- 2022-1-23
        
|
- Sub 寶來除息表()
- Application.ScreenUpdating = False '除權除息表
- Application.EnableEvents = False
- Application.DisplayStatusBar = False
- ActiveSheet.DisplayPageBreaks = False
- Dim i As Integer, S As Integer, k As Integer, j As Integer
- Dim Element
- With CreateObject("InternetExplorer.Application")
- '.Visible = True '可顯示網頁
- .Navigate "http://jdata.yuanta.com.tw/z/ze/zeb/zeb.djhtm"
- Do While .Busy Or .readyState <> 4: DoEvents: Loop
- Set Element = .Document.getElementsByTagName("table")(2) ' 已找出網頁的table內容在 0-3 中
- Sheets("sheet1").Cells.ClearContents
- With Sheets("sheet1")
- For i = 1 To Element.Rows.Length - 1
- For j = 0 To Element.Rows(i).Cells.Length - 1
- If j = 0 And i > 2 Then
- .Cells(i, j + 1) = Element.all.tags("a")(i - 3).innertext
- Else
- .Cells(i, j + 1) = Element.Rows(i).Cells(j).innertext
- End If
- Next
- Next
- End With
- .Quit
- End With
- Set Element = Nothing
-
- Application.DisplayStatusBar = True
- End Sub
複製代碼 回復 1# t8899 |
|