- ©«¤l
- 519
- ¥DÃD
- 54
- ºëµØ
- 0
- ¿n¤À
- 595
- ÂI¦W
- 259
- §@·~¨t²Î
- win 10
- ³nÅ骩¥»
- []
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2013-3-19
- ³Ì«áµn¿ý
- 2024-11-27
|
¦^´_ 1# paul3063
¸Õ¸Õ¬Ý- Sub TWSEtest()
- Dim sh As Worksheet
- Dim iDate$, stock$, yYear$, mMonth$, URL$
- Dim arDATA(), Table
- Dim i%, j%
- Set sh = Sheets("¤u§@ªí1")
- sh.Activate
- Cells.Clear
-
- stock = "2330" '³]©w¥N¸¹
- yYear = "2017" '³]©w¦~«×
- mMonth = "01" '³]©w¤ë¥÷
- iDate = yYear & mMonth & "01"
-
- URL = "http://www.twse.com.tw/exchangeReport/STOCK_DAY_AVG?response=Html&date=" & iDate & "&stockNo=" & stock
-
- With CreateObject("InternetExplorer.Application")
- .Visible = False ' ¤£Åã¥Ü IE
- .Navigate URL
- Do While .readyState <> 4
- DoEvents
- Loop
-
- Set Table = .document.getElementsBytagname("table")(0)
-
- With Table
- ReDim arDATA(.Rows.Length, .Rows(1).Cells.Length)
- For i = 0 To .Rows.Length - 1
- For j = 0 To .Rows(1).Cells.Length - 1
- On Error Resume Next
- arDATA(i + 1, j + 1) = .Rows(i).Cells(j).innertext
- Next
- Next
- End With
-
- sh.Cells(1, 1).Resize(UBound(arDATA), UBound(arDATA, 2)) = arDATA
- [A1].Select
-
- .Quit 'Ãö³¬ÂsÄý¾¹
-
- End With
-
- Set Table = Nothing
- Set sh = Nothing
- Erase arDATA()
- End Sub
½Æ»s¥N½X |
|