- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
|
¥»©«³Ì«á¥Ñ GBKEE ©ó 2016-1-11 14:06 ½s¿è
¦^´_ 2# kim223824 - Option Explicit
- Sub Ex_TABLE() '¬d¬Ý¤j½L¾ú¥v¸ê®Æ¬d¸ß,¸ê®Æ©Ò¦bªºTABLE
- Dim i As Integer, E As Object, url, xTable, A
- url = "http://www.twse.com.tw/ch/trading/indices/MI_5MINS_HIST/MI_5MINS_HIST.php"
- With CreateObject("InternetExplorer.application")
- .Visible = True
- .Navigate url
- Do While .Busy Or .readyState <> 4: DoEvents: Loop
- With .Document
- .ALL("myear").Value = "104"
- .ALL("mmon").Value = "12"
- For Each E In .ALL.tags("input")
- If E.Type = "button" And E.Value = "¬d¸ß" Then
- E.Click
- Exit For
- End If
- Next
- End With
- Do While .Busy Or .readyState <> 4: DoEvents: Loop
- Set xTable = .Document.getElementsByTagName("TABLE")
- On Error Resume Next
- For Each E In xTable
- i = i + 1
- Cells(i, 1) = A '¬d¬Ý¸ê®Æ¦b¨º¤@ÓTABLE
- A = A + 1
- i = i + 1
- Cells(i, "A") = E.innertext
- Next
- .Quit 'Ãö³¬ºô¶
- End With
- End Sub
½Æ»s¥N½X- Option Explicit
- Sub ¤j½L«ü¼Æ20160110()
- Dim xTable As Object, k As Integer, c As Integer, r As Integer
- Dim url As String, i As Integer, E As Object
- 'Sheets("¤U¸ü").Select
- url = "http://www.twse.com.tw/ch/trading/indices/MI_5MINS_HIST/MI_5MINS_HIST.php"
- With CreateObject("InternetExplorer.application")
- .Visible = True
- .Navigate url
- Do While .Busy Or .readyState <> 4: DoEvents: Loop
- With .Document
- .ALL("myear").Value = "104"
- .ALL("mmon").Value = "12"
- ' .all("onclick").Click '«ö¤U«öÁ䪺
- For Each E In .ALL.tags("input")
- If E.Type = "button" And E.Value = "¬d¸ß" Then
- E.Click '«ö¤U¬d¸ßÁä
- Exit For
- End If
- Next
- End With
- Do While .Busy Or .readyState <> 4: DoEvents: Loop
- 'Sub Ex_TABLE() ¬d¬Ý¤j½L¾ú¥v¸ê®Æ¬d¸ß,±oª¾¸ê®Æ©Ò¦bªºTABLE
- Set xTable = .Document.getElementsByTagName("TABLE")(10) '¸ê®Æ¦b³o
- With Sheets("¤U¸ü")
- .UsedRange.Clear
- k = k + 1
- For r = 0 To xTable.Rows.Length - 1
- For c = 0 To xTable.Rows(r).Cells.Length - 1
- .Cells(k, c + 1) = xTable.Rows(r).Cells(c).innertext
- Next
- k = k + 1
- Next
- End With
- .Quit
- End With
- End Sub
½Æ»s¥N½X |
|