ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ªÑ²¼¾ú¥v»ù®æªí

[µo°Ý] ªÑ²¼¾ú¥v»ù®æªí

¶i¤J³o­Óºô¯¸¨ú±o­ÓªÑ¾ú¥v»ù¡G
http://www.cnyes.com/twstock/ps_historyprice/2330.htm

Â^¨ú.JPG
2017-10-13 15:40

¥¦¥u¦³©T©wªº¤é´Á°Ï¶¡¸ê®Æ

½Ð±Ð¾É ¡G
              VBA ¦p¦ó¥Î ¿ï¥Î¨ä¤¤ªº"¶}©l¤é´Á"¤Î"µ²§ô¤é´Á"¤Î "¬d¸ß" ¦Ó¨ú±o§óªø°Ï¶¡ªº¸ê®Æªí

ÁÂÁÂ

¦^´_ 15# Scott090

¦h¤u ...

TOP

¦^´_ 14# jackyq


    ½Ð jackyq ¤j©ú¥Ü¡A¥H«K¾Ç²ß

ÁÂÁÂ

TOP

IE , ActiveX.EXE ³Ì¤j¯SÂI¬O¤°?  µ½¥Î¤§

TOP

¦^´_ 11# iamaraymond

§Ú·Q¬O¸ê®Æªº§¹¾ã©Ê°ÝÃD¡A¤£¬O°_©l¤é´Á¬O§_»P¸ê®Æ¤é´Á¤@­P
¦b¤U¦C¦ì§}¦³°Q½×¡A½Ð°Ñ¦Ò  
  http://forum.twbts.com/thread-20288-1-1.html

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2018-2-1 20:39 ½s¿è

¦^´_ 11# iamaraymond
³oºô­¶¥i¯à¤]¦³¬y¶qºÞ¨î
¸Õ¸Õ¬Ý
  1. Option Explicit
  2. Sub ªÑ»ù()
  3.     Dim stockno As String, mydate1 As String, mydate2 As String, myurl As String
  4.     Dim Ar As Variant, i As Integer, xTime As Date
  5.     Ar = Array("2005/1/1", "2006/1/1", "2007/1/1", "2008/1/1")
  6.     [B3] = 2303
  7.     stockno = [B3]
  8.     [B5] = Date
  9.     For i = 0 To UBound(Ar)
  10.         [b4] = Ar(i)
  11.         [A10].CurrentRegion.Clear
  12.         mydate1 = Format([b4], "YYYY/MM/DD")
  13.         mydate2 = Format([B5], "YYYY/MM/DD")
  14.         myurl = "https://www.cnyes.com/twstock/ps_historyprice.aspx?code=" & stockno & "&ctl00$ContentPlaceHolder1$startText=" & mydate1 & "&ctl00$ContentPlaceHolder1$endText=" & mydate2
  15.         With ActiveSheet.QueryTables.Add(Connection:= _
  16.             "URL;" & myurl, Destination:=Range("$A$10"))
  17.             .RefreshStyle = xlOverwriteCells
  18.             .SaveData = True
  19.             .AdjustColumnWidth = False
  20.             .WebSelectionType = xlSpecifiedTables
  21.             .WebFormatting = xlWebFormattingNone
  22.             .WebTables = "1"
  23.             Application.StatusBar = "¸ê®Æ¤U¸ü¤¤ ... " & [b4]
  24.             .Refresh BackgroundQuery:=False
  25.             .Delete
  26.         End With
  27.         With [A10].End(xlDown)
  28.             .Select
  29.             If Abs(.Cells - [b4]) > 15 Then
  30.                 MsgBox "¶}©l¤é´Á " & [b4] & " <****> " & .Cells
  31.             End If
  32.         End With
  33.         If i < UBound(Ar) Then
  34.             xTime = Time
  35.             Do
  36.                 DoEvents
  37.                 Application.StatusBar = xTime + #12:00:20 AM# & " - µ¥­Ô 20¬í ..." & Time
  38.             Loop While xTime + #12:00:20 AM# > Time
  39.         Else
  40.             MsgBox "µ{¦¡ §¹²¦ "
  41.         End If
  42.     Next
  43. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 8# GBKEE


   §Ú°O±o·|³y¦¨¤£¤@¼Ë¬O¦]¬°¦pªG¿é¤J¤é´Á­è¦n¸I¨ì°²¤é¡A¨º¸ê®Æ·|¥H¤U¤@­Ó¤u§@¤é¶}©l¡A¨Ò¦p¿é¤J20180128(¤é)¡A¨º´N·|§ì¨ì±q20180129(¤@)¶}©lªº¸ê®Æ
Excel VBAºô­¶¸ê®Æ¦¬¶°±Ð¾Ç:
http://forum.twbts.com/thread-20848-1-1.html

TOP

¦^´_ 8# GBKEE

   ¨S¦³°O¿ý¤U¨Ó¡A¤£¹L¦n¹³¤£¬O¤@­Ó¯S©wªº¡F¦³®É¥Î¤â°Êª½±µ¥hÀˬd¤S·|¦bºô­¶¤W¥X²{¸ê®Æ
¤U¦¸¸I¨ì§â¥¦­Ì°O¤U¨Ó°eµ¹°Ñ¦Ò¡C
§Ú¦bÃhºÃ¬Oºô¸ô¥»¨­ªº¶Ç¿é¤]»¡¤£©w

ÁÂÁÂ

TOP

[ª©¥DºÞ²z¯d¨¥]
  • GBKEE(2018/1/31 10:48): ¬Y¨ÇÀɪѲ¼Åª¤£¨ì¸ê®Æªº±¡§Î,¥i§_¦C¥X­þ¨ÇÀɪѲ¼

¦^´_ 8# GBKEE


    ÁÂÁ GBKEE ¤j¤j ´£¨Ñªº¡G
¸ê®Æ§¹¾ã©Êªº¬dÀ˾÷¨î¡B Clip Board ªº¤èªk

¥t¡A Do
                 .......
                 Application.StatusBar = " µ¥­Ô ºô­¶¸ê®Æ¤¤ ... "
          Loop
¤¤¡A¦³®É¤£ª¾¬Æ»òª¬ªp·|¦³¬Y¨ÇÀɪѲ¼Åª¤£¨ì¸ê®Æªº±¡§Î¡A©Ò¥H»Ý­n¥Î®É¶¡­p®É¨Ó±±¨î¨Ã©ñ±ó

¦A¦¸·P®¦

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2018-1-30 12:47 ½s¿è

¦^´_ 6# iamaraymond
³oºô­¶¥ÎQueryTable ±o¨úªº¸ê®Æ¦³®É°_©l¤é´Á·|¤£·Ç½T,¸Õ¸Õ­×§ï°_©l¤é´Á,¬Ý¬Ý¸ê®Æ¬O§_¥¿½T

¦^´_ 7# Scott090
  1. Option Explicit
  2. Sub Ex_Ie_Copy()
  3.     Dim Code As String, Price()
  4.     Dim date0 As Date, StartDate$, EndDate$, timer, time0 As Date, IE_StartDate As String
  5.     Dim E As Object, IE As Object
  6.     Code = "2330"
  7.     time0 = Time
  8.     Application.StatusBar = "¶}±Òºô­¶...."
  9.     '³]©w¸ê®Æ¶}©l¤Îµ²§ô¤é´Á
  10.     StartDate = Format(DateAdd("m", -12 * 10, Date), "yyyy/mm/dd") '¨ú10¦~¸ê®Æµ§
  11.     If StartDate < CDate("1994/09/07") Then
  12.         MsgBox "StartDate  " & StartDate & vbLf & "¤£¥i¤p©ó" & "1994/09/07"
  13.         End
  14.     End If
  15.     EndDate = Format(Date, "yyyy/mm/dd")
  16. Set IE = CreateObject("InternetExplorer.Application")
  17.     With IE
  18.             .navigate "http://www.cnyes.com/twstock/ps_historyprice/" & Code & ".htm"
  19.             Do:          DoEvents:             Loop While .Busy Or .readystate <> 4

  20.             With .Document.getElementsByTagName("input")
  21.                  .Item("ctl00$ContentPlaceHolder1$startText").Value = StartDate ' ¶}©l¤é´Á input name
  22.                  .Item("ctl00$ContentPlaceHolder1$endText").Value = EndDate     ' µ²§ô¤é´Á input name
  23.                  .Item("ctl00$ContentPlaceHolder1$submitBut").Click
  24.             End With
  25.             Do:          DoEvents:             Loop While .Busy Or .readystate <> 4
  26.             On Error Resume Next
  27.             Do
  28.                 Err.Clear
  29.                 Set E = .Document.getElementsByTagName("TABLE")(0)
  30.                 If E.INNERTEXT <> "" Then
  31.                     If Err = 0 Then
  32.                         If Abs(DateValue(E.Rows(E.Rows.Length - 1).Cells(0).INNERTEXT) - DateValue(StartDate)) <= 15 Then
  33.                             If Err = 0 Then Exit Do
  34.                         End If
  35.                     End If
  36.                End If
  37.              DoEvents
  38.              Application.StatusBar = " µ¥­Ô ºô­¶¸ê®Æ¤¤ ... "
  39.             Loop
  40.             On Error GoTo 0
  41.             CopyToClipbox E.OUTERHTML
  42.             Application.StatusBar = StartDate & " - " & EndDate & " ¸ê®Æ¦@ " & E.Rows.Length - 1 & " Ū¨ú.." & Application.Text(Time - time0, ["m¤À:S¬í ok"])
  43.             .Quit
  44.     End With
  45. End Sub
  46. Private Sub CopyToClipbox(strText As String)    '¤å¥»«þ¨©¨ì°Å¶KªO
  47.     With CreateObject("new:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
  48.         .SetText strText
  49.         .PutInClipboard
  50.     End With
  51.     With ActiveSheet
  52.         .UsedRange.Clear
  53.         .[A1].Select
  54.         .Paste
  55.     End With
  56. End Sub
½Æ»s¥N½X
  1. Sub Ex_Ie()
  2.     Dim Code As String, Price()
  3.     Dim StartDate$, EndDate$, time0 As Date
  4.     Dim E As Object
  5.     Dim Re%, Ce%
  6.     Code = "2330"
  7.     time0 = Time
  8.     ActiveSheet.Cells.Clear
  9.     Cells(1).Activate
  10.     Application.StatusBar = "¶}±Òºô­¶...."
  11.     '³]©w¸ê®Æ¶}©l¤Îµ²§ô¤é´Á
  12.     StartDate = Format(DateAdd("m", -12 * 10, Date), "yyyy/mm/dd") '¨ú10¦~¸ê®Æµ§
  13.     If StartDate < CDate("1994/09/07") Then
  14.         MsgBox "StartDate  " & StartDate & vbLf & "¤£¥i¤p©ó" & "1994/09/07"
  15.         End
  16.     End If
  17.     EndDate = Format(Date, "yyyy/mm/dd")
  18.    
  19.     With CreateObject("InternetExplorer.Application")
  20.             .navigate "http://www.cnyes.com/twstock/ps_historyprice/" & Code & ".htm"
  21.             Do:          DoEvents:             Loop While .Busy Or .readystate <> 4
  22.             With .Document.getElementsByTagName("input")
  23.                  .Item("ctl00$ContentPlaceHolder1$startText").Value = StartDate ' ¶}©l¤é´Á input name
  24.                  .Item("ctl00$ContentPlaceHolder1$endText").Value = EndDate     ' µ²§ô¤é´Á input name
  25.                  .Item("ctl00$ContentPlaceHolder1$submitBut").Click
  26.             End With
  27.             Do:          DoEvents:             Loop While .Busy Or .readystate <> 4
  28.             On Error Resume Next
  29.             Do
  30.                 Err.Clear
  31.                 Set E = .Document.getElementsByTagName("TABLE")(0)
  32.                 If E.INNERTEXT <> "" Then
  33.                     If Err = 0 Then
  34.                         If Abs(DateValue(E.Rows(E.Rows.Length - 1).Cells(0).INNERTEXT) - DateValue(StartDate)) <= 15 Then
  35.                             If Err = 0 Then Exit Do
  36.                         End If
  37.                     End If
  38.                 End If
  39.                 DoEvents
  40.                 Application.StatusBar = " µ¥­Ô ºô­¶¸ê®Æ¤¤ ... "
  41.             Loop
  42.             On Error GoTo 0
  43.             'ReDim Price(0 To E.Rows.Length - 1, 0 To E.Rows(0).Cells.Length - 1)
  44.             Application.StatusBar = StartDate & " - " & EndDate & " ¸ê®Æ¦@ " & E.Rows.Length - 2 & " Ū¨ú...... "
  45.             For Re = 0 To E.Rows.Length - 1 ' 19          '¨ú19¤Ñªº¾ú¥v¬ö¿ý
  46.                 For Ce = 0 To E.Rows(Re).Cells.Length - 1
  47.                     Cells(Re + 1, Ce + 1) = E.Rows(Re).Cells(Ce).INNERTEXT '¤é´Á¡B¶}¡B°ª¡B§C¡B¦¬¡Bº¦¶^  º¦% ¦¨¥æ¶q  ¦¨¥æª÷ÃB
  48.                    ' Price(Re, Ce) = E.Rows(Re).Cells(Ce).innertext   '¤é´Á¡B¶}¡B°ª¡B§C¡B¦¬¡Bº¦¶^  º¦% ¦¨¥æ¶q  ¦¨¥æª÷ÃB
  49.                 Next
  50.             Next
  51.             'ActiveSheet.Cells(1, "A").Resize(UBound(Price), UBound(Price, 2)).Value = Price
  52.         Application.StatusBar = StartDate & " - " & EndDate & " ¸ê®Æ¦@ " & E.Rows.Length - 2 & " Ū¨ú.." & Application.Text(Time - time0, ["m¤À:S¬í ok"])
  53.         .Quit
  54.     End With
  55. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : ¬Ý§O¤H¤£¶¶²´¡A¬O¦Û¤v­×¾i¤£°÷¡C
ªð¦^¦Cªí ¤W¤@¥DÃD