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

[µo°Ý] CreateObject("InternetExplorer.Application") °õ¦æ§¹¦³®É·|µLªk¸õ¥X??

´`ÁÙªº½d³ò
.Navigate "http://newmis.twse.com.tw/stock/group.jsp?ex=tse&ind=TIDX#STATISTICS"
        Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
        Set Element = .document.getelementsbytagname("table")
        With Sheets("SHEET1")
           .Cells.Clear
           K = 0
            'For s = 0 To element.Length - 1 '¤£ª¾¦¹ºô­¶ªºtable¤º®e:½Ð¥ý¦æ´ú¸Õºô­¶ªº§¹¾ãtable¤º®e
            For S = 2 To 2                    '¤w§ä¥Xºô­¶ªºtable¤º®e¦b 0-3 ¤¤
                For i = 0 To Element(S).Rows.Length - 1
                    K = K + 1
               '  For j = 0 To Element(S).Rows(i).Cells.Length - 1   '¸ê®ÆªºÄæ¦ì¦@6¦ì
                  j = 2
                         .Cells(K, j + 1) = Element(S).Rows(i).Cells(j).innerText
                        
                '    Next
               Next
            Next
     '       .Cells.EntireColumn.AutoFit            '¦Û°Ê½Õ¾ãÄæ¼e
      '      .Cells.EntireRow.AutoFit               '¦Û°Ê½Õ¾ã¦C°ª
        End With

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2014-1-15 19:33 ½s¿è

¦^´_ 21# t8899
ThisWorkbook µ{¦¡½X
  1. Option Explicit
  2. Dim Ie As Object, Msg As Boolean
  3. Private Sub Workbook_BeforeClose(Cancel As Boolean)
  4.     Ie.Quit
  5. End Sub
  6. Private Sub Workbook_Open()
  7.     Set Ie = CreateObject("InternetExplorer.Application")
  8.     Ie.Navigate "http://newmis.twse.com.tw/stock/group.jsp?ex=tse&ind=TIDX#STATISTICS"
  9.     Do While Ie.Busy Or Ie.ReadyState <> 4: DoEvents: Loop
  10.     Msg = False
  11.     timestock
  12. End Sub
  13. Private Sub timestock()
  14.     Dim i As Integer, S As Integer, K As Integer, j As Integer
  15.     Dim Element
  16.     If Msg = True Then Ie.Quit:   End
  17.     Application.OnTime Time + #12:00:30 AM#, "ThisWorkbook.timestock"
  18.     Application.ScreenUpdating = False
  19.     Do While Ie.Busy Or Ie.ReadyState <> 4: DoEvents: Loop
  20.     Set Element = Ie.document.getelementsbytagname("table")
  21.     With Sheets("sheet5")
  22.         .Cells.Clear
  23.         For S = 2 To 3                    '¤w§ä¥Xºô­¶ªºtable¤º®e¦b 0-3 ¤¤
  24.             For i = 0 To Element(S).Rows.Length - 1
  25.                 K = K + 1
  26.                 For j = 0 To Element(S).Rows(i).Cells.Length - 1   '¸ê®ÆªºÄæ¦ì¦@6¦ì
  27.                     .Cells(K, j + 1) = Element(S).Rows(i).Cells(j).innerText
  28.                 Next
  29.             Next
  30.         Next
  31.      '       .Cells.EntireColumn.AutoFit            '¦Û°Ê½Õ¾ãÄæ¼e
  32.       '      .Cells.EntireRow.AutoFit               '¦Û°Ê½Õ¾ã¦C°ª
  33.     End With
  34. End Sub
  35. Private Sub The_End()  '°±¤îªºµ{¦¡
  36.     Msg = True
  37. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_  t8899
ThisWorkbook µ{¦¡½X
GBKEE µoªí©ó 2014-1-15 16:31

½Ð°Ý¦p¦ó°±¤î??

TOP

¦^´_  t8899
ThisWorkbook µ{¦¡½X
GBKEE µoªí©ó 2014-1-15 16:31

30¬í®É¶¡·Q¥ÑK1Àx¦s®æ¨Ó±±¨î¡A­n¦p¦ó§ï??

Dim i As Integer, S As Integer, K As Integer, j As Integer
     Dim Element
     Dim RNG
    If Sheet3.Range("K1").Value = 1 Then Set RNG = #12:01:00 AM#
    If Sheet3.Range("K1").Value = 2 Then Set RNG = #12:02:00 AM#
    If Sheet3.Range("K1").Value = 3 Then Set RNG = #12:00:30 AM#
    If Sheet3.Range("K1").Value = 4 Then Set RNG = #12:00:10 AM#

    Application.OnTime Time + RNG, "timestock"

----------------------------------------------------
#12:01:00 AM# »Ý­nª«¥ó ???

TOP

30¬í®É¶¡·Q¥ÑK1Àx¦s®æ¨Ó±±¨î¡A­n¦p¦ó§ï??

Dim i As Integer, S As Integer, K As Integer, j As Inte ...
t8899 µoªí©ó 2014-1-15 20:36

©êºp¡A¥´ÂZ.......¤w¸Ñ¨M....................
If Sheet3.Range("K1").Value = 1 Then Application.OnTime Time + #12:01:00 AM#, "timestock"
    If Sheet3.Range("K1").Value = 2 Then Application.OnTime Time + #12:02:00 AM#, "timestock"
    If Sheet3.Range("K1").Value = 3 Then Application.OnTime Time + #12:00:30 AM#, "timestock"
    If Sheet3.Range("K1").Value = 4 Then Application.OnTime Time + #12:00:10 AM#, "timestock"

TOP

¦^´_  t8899
¦¹ºô­¶ªºµ{¦¡½X
GBKEE µoªí©ó 2014-1-13 17:40


¬O§_¤Ö¤F Set Element = Nothing ³o¤@¦æ??
À³´¡¦b34©Î36¦æ«e­±??

TOP

¦^´_ 26# t8899
  1. Private Sub timestock()
  2.     Dim i As Integer, S As Integer, K As Integer, j As Integer
  3.     Dim Element
  4.     'timestock³oµ{§Ç¤ºªºDim«Å§i ¬O¬°timestock³oµ{§Çªº¨p¥ÎÅܼÆ
  5.     'timestock³oµ{§Ç°õ¦æ§¹²¦©Ò¦³ªº¨p¥ÎÅܼƷ|¦Û°ÊÄÀ©ñ
  6.     'µL¶· Set Element = Nothing
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¥»©«³Ì«á¥Ñ t8899 ©ó 2014-2-10 14:59 ½s¿è
¦^´_  t8899
GBKEE µoªí©ó 2014-1-16 07:25


½Ð°Ý¤µ¤Ñ³s¤F¨â¤F¤p®É¥X²{¿ù»~¦b³o¤@¦æ
Do While Ie.Busy Or Ie.ReadyState <> 4: DoEvents: Loop


¦p¦ó¸Ñ¨M?
1ª½±µ¸õ¥X
2.¤£²z·|¿ù»~
¦¹¨âºØª¬ªp¡A¦U¦p¦ó³B²z?

TOP

        ÀR«ä¦Û¦b : ¥ÌÄ@°µ¡BÅw³ß¨ü¡C
ªð¦^¦Cªí ¤W¤@¥DÃD