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

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

¥»©«³Ì«á¥Ñ t8899 ©ó 2014-1-13 15:40 ½s¿è

¦³®É¥i¥H¸õ¥X??¦³®É¤SµLªk¸õ¥X??¯u©_©Ç.......
¥J²ÓÆ[¹î¡A²Ä¤@¦¸°õ¦æ¬°¨â­Óieplorer.exe ¦b°õ¦æ ??¡A±µ¤U¨Ó´N¤@¦¸¤@­Ó........
§Ú§â   .Visible = True  '==> enable
´Ý¯d¬O¤@­ÓªÅ¥Õªººô­¶

TOP

¦^´_ 2# t8899
On Error Resume Next ªº¥Øªº??
«D¥²­n§O³o¼Ë¨Ï¥Î

TOP

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

TOP

¥»©«³Ì«á¥Ñ t8899 ©ó 2014-1-14 09:00 ½s¿è
¦^´_  t8899
¦¹ºô­¶ªºµ{¦¡½X
GBKEE µoªí©ó 2014-1-13 17:40

1.¦¹ºô­¶¦³¤T­Óªí®æ¡A§Ú¥u­n
²Ä¤G­Ó©ñ¤JA1¤Î
²Ä¤T­Ó"ªÑ²¼"Äæ¦ì©ñ¤JC5
¦p¦ó­×§ï?
2.¥Ñ©ó§Ú30¬í·|°õ¦æ¤@¦¸¦¹µ{§Ç
­ÉIE §ì¶}¶}ÃöÃö¡A¦ü¥G¸ûºC...¥Î¤W¼Óªºµ{§Ç¦³®ÉÁÙ¬O·|¥d¦íµLªkÃö³¬?(¤@ª½¥X²{"ok"°T®§µøµ¡")
¬O§_¦³¨ä¥L¼gªk??

TOP

¤@ª½¥X²{"ok"°T®§µøµ¡¬O®M¤J§Úªº¥¨¶°ªº¤@¬q
For i = 1 To 10
Dim aaa As Variant
aaa = Sheets("Sheet5").Range("C3")
If IsNumeric(aaa) Then Exit For
If Not IsNumeric(aaa) Then Run "timestock"
Next

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2014-1-14 13:57 ½s¿è

¦^´_ 15# t8899
¤@ª½¥X²{"ok"°T®§µøµ¡??  §A¬O¤¤¾Ç¥ÍÀ³¸Ó·|Ãö³¬³o"ok"µøµ¡.¦³°ÝÃD¸ÕµÛ¦Û¤v¸Ñ¨M,VBA¤~·|¶i¨B.
ªþ¤WÀɮ׬ݬÝ
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¥»©«³Ì«á¥Ñ t8899 ©ó 2014-1-14 14:48 ½s¿è
¦^´_  t8899
¤@ª½¥X²{"ok"°T®§µøµ¡??  §A¬O¤¤¾Ç¥ÍÀ³¸Ó·|Ãö³¬³o"ok"µøµ¡.¦³°ÝÃD¸ÕµÛ¦Û¤v¸Ñ¨M,VBA¤~·|¶i¨B. ...
GBKEE µoªí©ó 2014-1-14 13:50

  '  MsgBox "0K"
¥D­n¤£¬OMsgBox ªº°ÝÃD¡A¬Oie ¸õ¤£¥X¨Ó..........
²{¦b¤S¥i¥H¸õ¥X¨Ó¤F!
ÁÂÁÂ! §Ú¦Û¤v¦bºCºC§ä..........
§Ú¤]¦³¿³½ì§â¥¦§ä¥X¨Ó!:)

TOP

¦^´_  t8899
¤@ª½¥X²{"ok"°T®§µøµ¡??  §A¬O¤¤¾Ç¥ÍÀ³¸Ó·|Ãö³¬³o"ok"µøµ¡.¦³°ÝÃD¸ÕµÛ¦Û¤v¸Ñ¨M,VBA¤~·|¶i¨B. ...
GBKEE µoªí©ó 2014-1-14 13:50

§Ú§ï¤F¤@¤U¡A¬O§_¸ò³o¦³Ãö??(¬õ¦â³¡¥÷)
Sub timestock()
Application.ScreenUpdating = False
    Dim i As Integer, S As Integer, K As Integer, j As Integer
    Dim Element
    With CreateObject("InternetExplorer.Application")
        '.Visible = True           '¥iÅã¥Üºô­¶
       .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("SHEET5")
         '  .Cells.Clear
          .Range("A1:F17").ClearContents  
            'For s = 0 To element.Length - 1 '¤£ª¾¦¹ºô­¶ªºtable¤º®e:½Ð¥ý¦æ´ú¸Õºô­¶ªº§¹¾ãtable¤º®e
            For S = 2 To 3                    '¤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
       .Quit
    End With
    Set Element = Nothing
  '  MsgBox "0K"
End Sub

TOP

¦^´_ 18# t8899
³o¤è¦V¬O¹ïªº,¦³¶i¨B

  1. For S = 2 To 3                    '§ä¥Xºô­¶ªºtable ¤º®e¦b 0-3 ¤¤
  2.   'j=2
  3. IF S=2 Then j=?                '¼g¤U§Aªº±ø¥ó
  4. IF S=3 Then j=?
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_  t8899
³o¤è¦V¬O¹ïªº,¦³¶i¨B
GBKEE µoªí©ó 2014-1-14 15:31

   With CreateObject("InternetExplorer.Application")
           .Navigate "http://newmis.twse.com.tw/stock/group.jsp?ex=tse&ind=TIDX#STATISTICS
  .Quit

½Ð°Ý30¬í§ì¤@¦¸¸ê®Æ, §ì§¹µL¶· quit ,¥i¥H§ï¦¨¨C¹j30¬í¦AÄ~Äò§ì¶Ü??(¤¤¶¡°µ¤@­Ó´`ÁÙ)
¤£¥Î¤@ª½°õ¦æ iexplorer.exe ¶}¶}ÃöÃö???

TOP

        ÀR«ä¦Û¦b : ªY½à§O¤H´N¬O²øÄY¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD