- ©«¤l
- 12
- ¥DÃD
- 5
- ºëµØ
- 0
- ¿n¤À
- 19
- ÂI¦W
- 0
- §@·~¨t²Î
- XP
- ³nÅ骩¥»
- 2010
- ¾\ŪÅv
- 10
- µù¥U®É¶¡
- 2015-1-3
- ³Ì«áµn¿ý
- 2017-2-27

|
¥»©«³Ì«á¥Ñ GBKEE ©ó 2016-2-23 10:38 ½s¿è
GBKEE¡Bjoey0415¤Î¦U¦ì¤j¤j§A¦n
·Q½Ð±Ð§A¡A§Ú¥Ø«e¦b¸Õ¤U¸üӪѨC¤éªº¿Ä¸ê¿Ä¨÷ºô¶http://www.twse.com.tw/ch/trading/exchange/MI_MARGN/MI_MARGN.php¡Aª¦¤å®É¦³¬Ý¨ì³oÓjoey0415¤j¤j¼¶¼gªº(http://forum.twbts.com/viewthrea ... a=pageD1&page=2)ªºµ{¦¡½Xex()¨ç¦¡¡A¦ý¬O¸ÕµÛ¥h°õ¦æ®É¡A°õ¦æ¨ì Set evt = .Document.createEvent("HTMLEvents") ®É¡A´N¥X²{ª«¥ó¤£¤ä´©¦¹ÄÝ©Ê»P¤èªk¿ù»~¡A¤£¾å±o
joey0415¡BGBKEE¤j¤j¥i¥HÀ°¦£¨ó§U¶Ü
Sub ex()
With CreateObject("internetexplorer.application")
.Visible = True
.Navigate "http://www.twse.com.tw/ch/trading/exchange/MI_MARGN/MI_MARGN.php"
Do Until .ReadyState = 4
DoEvents
Loop
.Document.getElementById("date-field").Value = "104/08/12" '¶ñ¤J
'---------¡A¤º«Øªºfireevent ªºonchange¥¢®Ä¡A§ï¥Î½Õ¥Îjsªº¤èªk--------
Set evt = .Document.createEvent("HTMLEvents")
evt.initEvent "change", True, False
Set lst = .Document.all("selectType") 'optionªºname¬OselectType¡A¦ýgetElementsByNameµLªk³B²z¡Anall¤~¦æ
lst.selectedIndex = 0
lst.dispatchEvent evt
.Document.all("query-button").Click
Do While .ReadyState <> 4 Or .Busy: DoEvents: Loop
Application.Wait Now + TimeValue("00:00:5")
' Stop
' For Z = 0 To 10
' MsgBox .Document.getElementsByTagName("table")(Z).innerText
' Next
Stop
Set hTable = .Document.getElementsByTagName("table")(3) '²Ä4Ótable
' tt = hTable.Rows.Length
' qq = hTable.Rows(2).Cells.Length
With ActiveSheet
For i = 1 To hTable.Rows.Length - 1 '«e3Ó¬O¼ÐÃD»PªÅ¥Õ¸õ¹L
For j = 0 To hTable.Rows(i).Cells.Length - 1
.Cells(i, j + 1) = hTable.Rows(i).Cells(j).innerText
Next
Next
End With
.Quit
' MsgBox "OK"
End With
End Sub |
|