股票名稱不正常
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")
On Error Resume Next
Sheets("sheet1").Range("a:e").ClearContents
With Sheets("sheet1")
For S = 2 To 2 '已找出網頁的table內容在 0-3 中
For i = 1 To Element(S).Rows.Length - 1
k = k + 1
For j = 0 To 4 '資料的欄位共6位
.Cells(k, j + 1) = Element(S).Rows(i).Cells(j).innerText
Next
Next
Next
End With
.Quit
End With
Set Element = Nothing
Application.DisplayStatusBar = True
End Sub
[attach]27366[/attach]