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

[µo°Ý] ¥æ©ö¶i¦æ¤¤ªº1¤ÀÄÁªÑ»ù¬ö¿ý

¥»©«³Ì«á¥Ñ GBKEE ©ó 2018-9-3 16:27 ½s¿è

¦^´_ 1# Scott090
¨S¹ê»Ú°õ¦æ¾ã¤Ñ¦æ±¡¹L,½Ð¦Û¦æ´ú¸Õ
  1. Option Explicit
  2. Sub EX()  'Àɮ׶}±Ò®É½Ð«ü©w°õ¦æ¦¹µ{¦¡
  3.     If Time < #9:00:00 AM# Then
  4.         Application.OnTime #9:00:00 AM#, "Ex_yahoo"
  5.     ElseIf Time <= #2:30:00 PM# Then
  6.         Ex_yahoo
  7.     End If
  8. End Sub
  9. Sub Ex_yahoo()
  10.     Dim oXmlhttp As Object, oHtmldoc As Object, E As Object
  11.     Dim R As Integer, RR As Integer, C As Integer, xTime As Double
  12.     If Time <= #2:30:00 PM# Then Application.OnTime #12:05:00 AM#, "Ex_yahoo"   '5¤ÀÄÁ«á¦A«×°õ¦æ
  13.     Set oXmlhttp = CreateObject("msxml2.xmlhttp")
  14.     Set oHtmldoc = CreateObject("htmlfile")
  15.     With oXmlhttp
  16.         .Open "Get", "https://tw.stock.yahoo.com/q/ts?s=2330&t=50", False
  17.         .Send
  18.         oHtmldoc.write .responseText
  19.     End With
  20.     With Sheets("¤u§@ªí1")
  21.         Set E = oHtmldoc.all.tags("table")(6)
  22.         If .[a1] <> E.Rows(0).Cells(0).innertext & "-" & E.Rows(0).Cells(1).innertext Then
  23.             .Cells.Clear
  24.             .[a1] = E.Rows(0).Cells(0).innertext & "-" & E.Rows(0).Cells(1).innertext
  25.         End If
  26.         Set E = oHtmldoc.all.tags("table")(7)
  27.         If .[a2] = "" Then
  28.             For C = 0 To E.Rows(0).Cells.Length - 1
  29.                 .Cells(2, C + 1) = E.Rows(0).Cells(C).innertext
  30.             Next
  31.         End If
  32.         For R = E.Rows.Length - 1 To 1 Step -1
  33.             xTime = TimeValue(E.Rows(R).Cells(0).innertext)
  34.             If IsError(Application.Match(xTime, .[A:A], 0)) Then
  35.                 RR = Application.CountA(.[A:A]) + 1
  36.                 For C = 0 To E.Rows(R).Cells.Length - 1
  37.                 .Cells(RR, C + 1) = E.Rows(R).Cells(C).innertext
  38.                 Next
  39.             End If
  40.         Next
  41.     End With
  42.     Set oXmlhttp = Nothing
  43.     Set oHtmldoc = Nothing
  44.    
  45. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : ®É®É¦n¤ß´N¬O®É®É¦n¤é¡C
ªð¦^¦Cªí ¤W¤@¥DÃD