- ©«¤l
- 361
- ¥DÃD
- 57
- ºëµØ
- 0
- ¿n¤À
- 426
- ÂI¦W
- 0
- §@·~¨t²Î
- win7
- ³nÅ骩¥»
- 2003,2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2010-5-13
- ³Ì«áµn¿ý
- 2022-12-8
|
¦^´_ 5# a68951
table 4 ¨ä¹ê¬O²Ä¤Ó¡Aexcel ¬O±q0¶}©l
¤£¬O¨S¦³Äæ¦Ó¬O«e±ªºÄæ¦ì¦³¦X¨Ö»P«á±ªºtalbe¤¤ªºÄæ¦ìªø«×¤£¤@¸m
¤U±¬O×§ï¹Lªºµ{¦¡½X- Sub ex()
- Application.ScreenUpdating = False '°±¤î §ó·sSheet®É µe±¡A¥[³t¹Bºâ
- Application.DisplayAlerts = False '°±¤î §R°£Sheet®É ¹w³]ªºÄµ§i
- Cells.Clear
- 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 = 1
- 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
- Set hTable = .Document.getElementsByTagName("table")(4) '²Ä4Ótable
- For i = 0 To hTable.Rows.Length - 1 '«e3Ó¬O¼ÐÃD»PªÅ¥Õ¸õ¹L
- For j = 0 To hTable.Rows(i).Cells.Length - 1
- If j = 0 And i > 2 Then
- Cells(i + 1, j + 1) = "'" & hTable.Rows(i).Cells(j).innerText
- Else
- Cells(i + 1, j + 1) = hTable.Rows(i).Cells(j).innerText
- End If
- Next
- Next
- .Quit
- End With
-
- Range("A3:B3").Insert Shift:=xlToRight
- Range("A2:B2").Select
- Selection.Cut
- Range("A3").Select
- ActiveSheet.Paste
- Range("E2:F2").Select
- Selection.Cut
- Range("O3").Select
- ActiveSheet.Paste
- Range("A1").Select
- Range("D2:h2").Insert Shift:=xlToRigh
-
- Application.ScreenUpdating = True '°±¤î §ó·sSheet®É µe±¡A¥[³t¹Bºâ
- Application.DisplayAlerts = True '°±¤î §R°£Sheet®É ¹w³]ªºÄµ§i
-
- End Sub
½Æ»s¥N½X |
|