- ©«¤l
- 3
- ¥DÃD
- 0
- ºëµØ
- 0
- ¿n¤À
- 5
- ÂI¦W
- 0
- §@·~¨t²Î
- WIN10
- ³nÅ骩¥»
- office2010
- ¾\ŪÅv
- 10
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2016-4-22
- ³Ì«áµn¿ý
- 2018-1-29
|
¦^´_ 22# frankchen7
ÁÂÁÂGBKEEª©¤jªº´£¥Ü¡A§Úק令¤U±ªº¤è¦¡¤w¥i¥¿±`§ì¨ú
Sub ¹d¦ëºô_¾ú¥v¦æ±¡()
Dim Sh As Worksheet, Code As String, d_Start As String, d_End As String
Dim A As Object, i As Integer, c As Integer, T As Date
Code = InputBox("¿é¤JªÑ²¼¥N¸¹:", "ªÑ²¼¥N¸¹", 2303)
d_End = InputBox("¿é¤Jµ²§ô¤é´Á", "µ²§ô¤é´Á", Date)
If Len(Code) <= 3 Or Not IsDate(d_End) Then Exit Sub
Set Sh = ActiveSheet
With Sh
.UsedRange.Clear
.[a1] = "ªÑ²¼¥N½X"
.[b1] = "°_©l¤é´Á"
.[c1] = "µ²§ô¤é´Á"
.[a2] = Code
.[b2] = DateAdd("yyyy", -3, d_End) '¤U¸ü¤T¦~ªº¾ú¥vªÑ»ù
.[c2] = d_End
Code = .[a2]
d_Start = Format(.[b2], "yyyy/mm/dd")
d_End = Format(.[c2], "yyyy/mm/dd")
End With
With CreateObject("InternetExplorer.application")
.Navigate "http://www.cnyes.com/twstock/ps_historyprice/" & Code & ".htm"
.Visible = True
Application.StatusBar = Code & "¾ú¥v¦æ±¡ µ¥Ô¤¤..."
Do While .Busy Or .readyState <> 4
DoEvents
Loop
With .Document
.all("code").Value = Code '¶ñ¤J¥N½X (¤£»Ýn¦h¾lªº)
.all("ctl00$ContentPlaceHolder1$startText").Value = d_Start '¶ñ¤J°_©l®É¶¡
.all("ctl00$ContentPlaceHolder1$endText").Value = d_End '¶ñ¤Jµ²§ô®É¶¡
For Each E In .GetElementsByName("ctl00$ContentPlaceHolder1$submitBut")
If E.Value = "¬d¸ß" Then E.Click '°e¥X¬d¸ßÁä
Next
End With
T = TIME
Do
DoEvents
Loop Until TIME > T + #12:00:08 AM#
Set A = .Document.GetElementsByTagName("table")(1)
Application.StatusBar = Code & "¾ú¥v¦æ±¡ ¤U¸ü¤¤..."
Cells(2, 1) = .Document.GetElementsByTagName("span")(79).innertext
For i = 0 To A.Rows.Length - 1
For c = 0 To A.Rows(i).Cells.Length - 1
Sh.Cells(i + 3, c + 1) = A.Rows(i).Cells(c).innertext
Next
' .Navigate "http://forum.twbts.com/tag.php?name=ºô¶¤¸¯À"
' .Visible = True
Next
.Quit
End With
Application.StatusBar = Code & "¾ú¥v¦æ±¡" & Application.Text(TIME - T, "[S] ¬í") & "¤U¸ü§¹¦¨"
MsgBox "OK"
Application.StatusBar = False
End Sub
:D |
|