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

[µo°Ý] ¤U¸ü°ÝÃD

[µo°Ý] ¤U¸ü°ÝÃD

¥»©«³Ì«á¥Ñ spermbank ©ó 2013-9-6 10:32 ½s¿è

¤j®a¦n:
     §Ú·Q¤U¸ü¦pºô§}http://newmis.twse.com.tw/stock/fibest.jsp?stock=1101ªº³Ì¨Î¤­ÀÉ»ù¶q¸ê°T´¦¥Ü¡C
     ¦]¬°¨Ï¥Î¹Lexcel±qºô¯¸¨ú±o¥~³¡¸ê®Æªº¥\¯à¡A¦ý¬OµLªkŪ¨ú¡A¤£ª¾¹D¬O¤°»ò°ÝÃD¡C

    ©Ò¥H·Q»¡¬O§_¥i¥H¦b¤À­¶¿ï¨úªÑ¸¹¦WºÙ¡A±Ò°Ê¥¨¶°¡A¦A±q¦p¤Wºô§}±N¥Ø«e®É¶¡©Ò´¦¥Üªº³Ì¨Î¤­ÀÉ»ù¶q¸ê°T¡AÀx¦s¦¨csvÀÉ¡A¨Ã±N¶R¶i¡B½æ¥X¼Æ¶q¥[Á`¡AÅã¥Ü©ó¤À­¶¤¤©O?
    ÁÂÁ¡C

¦^´_ 1# spermbank
µ¹§A¤U¸üªºµ{¦¡½X ,¨ä¾lªº°ÝÃD¥i¹î¬Ý¥»°Q½×°Ïªº¥DÃD,¥[¥H²Õ¦X(¦Û¤v¦h½m²ß vba ·|¶i¨B)
  1. Option Explicit
  2. Sub °ò¥»¥«ªp³ø¾Éºô¯¸()
  3.     Dim xlVbTable(1 To 2) As Object, R As Integer, C As Integer, i As Variant, Y As Integer
  4.     With CreateObject("InternetExplorer.Application")
  5.         .Visible = True
  6.        .Navigate "http://newmis.twse.com.tw/stock/fibest.jsp?stock=1101"
  7.         Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
  8.         Set xlVbTable(1) = .Document.getElementById("hor-minimalist-a")
  9.         Set xlVbTable(2) = .Document.getElementById("hor-minimalist-b")
  10.         On Error Resume Next
  11.         With ActiveSheet
  12.             .Cells.Clear
  13.             Y = 1
  14.             For i = 1 To 2
  15.                 For R = 0 To xlVbTable(i).Rows.Length - 1
  16.                     For C = 0 To xlVbTable(i).Rows(R).all.Length - 1
  17.                         .Cells(Y, C + 1) = xlVbTable(i).Rows(R).Cells(C).innertext
  18.                     Next
  19.                     Y = Y + 1
  20.                 Next
  21.             Next
  22.         End With
  23.        .Quit
  24.     End With
  25. End Sub
  26.    
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¥»©«³Ì«á¥Ñ spermbank ©ó 2013-9-6 14:15 ½s¿è

¦^´_ 2# GBKEE


    ·PÁÂG¤j¡A¦ý¬O§Úµo²{­Ó°ÝÃD¡A¦]¬°³o­Óºô¯¸¶}±Ò«á¡A·|Ū¨ú§Y®É¸ê®Æ¡A­Yª½±µ°õ¦æ¥¨¶°¡A³t«×¹L§Ö¡A·|µo¥Í""µLªk¨C¦¸""¸ê®Æ§¹¥þ½Æ»s¦Ü¤À­¶
    §Ú§Q¥ÎApplication.Wait Now + TimeValue("00:00:02")¨Ó¨Ïºô§}°±¯d2¬íµ¥«Ýºô­¶¸ê®ÆŪ¤J¸ê®Æ¦A½Æ»s¦Ü¤À­¶¡AÁöµM¥i¥H´£°ª¤@ÂI¸ê®Æ§¹¥þ½Æ»s
    ¥i¬OÁÙ¬O¦³®ÉµLªk§¹¥þŪ¨ì¡A¬O§_¦³¤°»ò§PÂ_¤è¦¡¡AÁÙ¬O­þÃ䦳°ÝÃD©O?ÁÂÁ¡C
   
    ­Y¬O¥ÎGoogle Chrome¬O§âInternetExplorer.Application§ï¦¨¤°»ò©O?
    ºô­¶¬O§_¤£­nÅã¥Ü´N½Æ»s¦Ü¤À­¶©O? ÁÂÁ¡C

TOP

¦^´_ 3# spermbank
·|µo¥Í""µLªk¨C¦¸""¸ê®Æ§¹¥þ½Æ»s¦Ü¤À­¶,¶K¤W§Aªºµ{¦¡½X¬Ý¬Ý
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 4# GBKEE

Option Explicit
Sub °ò¥»¥«ªp³ø¾Éºô¯¸()
    Sheets("¤u§@ªí3").Select
    Dim xlVbTable(1 To 2) As Object, R As Integer, C As Integer, i As Variant, Y As Integer
    With CreateObject("InternetExplorer.Application")
        .Visible = True
       .Navigate "http://newmis.twse.com.tw/stock/fibest.jsp?stock=5490"
        Application.Wait Now + TimeValue("00:00:02")
        Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
        Set xlVbTable(1) = .Document.getElementById("hor-minimalist-a")
        Set xlVbTable(2) = .Document.getElementById("hor-minimalist-b")
        On Error Resume Next
        With ActiveSheet
            .Cells.Clear
            Y = 1
            For i = 1 To 2
                For R = 0 To xlVbTable(i).Rows.Length - 1
                    For C = 0 To xlVbTable(i).Rows(R).all.Length - 1
                        .Cells(Y, C + 1) = xlVbTable(i).Rows(R).Cells(C).innertext
                    Next
                    Y = Y + 1
                Next
            Next
        End With
       .Quit
    End With
End Sub

TOP

¦^´_ 5# spermbank


    ­Y¬O¥ÎGoogle Chrome¬O§âInternetExplorer.Application§ï¦¨¤°»ò©O?
    ºô­¶¬O§_¤£­nÅã¥Ü´N½Æ»s¦Ü¤À­¶©O? ÁÂÁ¡C

TOP

¦^´_ 6# spermbank
§Aªºµ{¦¡½X¨S°ÝÃD
¥i¦A»¡©ú  ·|µo¥Í""µLªk¨C¦¸""¸ê®Æ§¹¥þ½Æ»s¦Ü¤À­¶ ¬O¤°»ò±¡§Î??
CreateObject("InternetExplorer.Application") ¬OMicroSoft ªº iexplore.exe
Google Chrome ¤£¾A¥Î
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

½Ð°Ý G¤j
Busy Or ReadyState  getElementById ¬O InternetExplorer.Application ªºÄݩʶÜ
§Ú¥Î F1 §ä¤£¨ì
ÁÂÁÂ

TOP

¥»©«³Ì«á¥Ñ spermbank ©ó 2013-9-6 15:13 ½s¿è

¦^´_ 7# GBKEE


G¤j±z¦n:
     ¤j·§´N¬O¦pªþ¥ó¨â±i¹Ï¤ù©Ò¥Ü(Ū¤£¨ìªº±¡ªp¤£¤@©w)¡C
     ¥t¥~ºô­¶·|¶]¥X¨Ó¯àÁôÂöÜ? ÁÂÁ¡C
     
     §ï¦¨¶}±Òºô­¶¦h2¬í¡A¯à°÷§¹¾ã½Æ»s¾÷²vÅÜ90%¥H¤W¡A¦ý¬O³t«×¤WºC2¬í¤]¤£¯à§¹¥þ¸Ñ¨M°ÝÃD¡C

1.PNG (8.15 KB)

1.PNG

2.PNG (9.47 KB)

2.PNG

TOP

¦^´_ 9# spermbank
VBA ¨S¦³¦w¸Ë IE ªº»¡©ú
  1. Option Explicit
  2. Sub °ò¥»¥«ªp³ø¾Éºô¯¸()
  3.     Dim xlVbTable(1 To 2) As Object, R As Integer, C As Integer, i As Variant, Y As Integer
  4.    Sheets("¤u§@ªí3").Select
  5.    With CreateObject("InternetExplorer.Application")
  6.        ' .Visible = True
  7.        .Navigate "http://newmis.twse.com.tw/stock/fibest.jsp?stock=5490"
  8.         Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
  9.         Application.Wait Now + TimeValue("00:00:02")   'IE¶}±Ò«á¦A¼È°±2¬íµ¥­Ô¤U¸üIE¸ê®Æ
  10.         Set xlVbTable(1) = .Document.getElementById("hor-minimalist-a")
  11.         Set xlVbTable(2) = .Document.getElementById("hor-minimalist-b")
  12.         On Error Resume Next
  13.         With ActiveSheet
  14.             .Cells.Clear
  15.             Y = 1
  16.             For i = 1 To 2
  17.                 For R = 0 To xlVbTable(i).Rows.Length - 1
  18.                     For C = 0 To xlVbTable(i).Rows(R).all.Length - 1
  19.                         .Cells(Y, C + 1) = xlVbTable(i).Rows(R).Cells(C).innertext
  20.                     Next
  21.                     Y = Y + 1
  22.                 Next
  23.             Next
  24.         End With
  25.        .Quit
  26.     End With
  27. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : Ãø¦æ¯à¦æ¡AÃø±Ë¯à±Ë¡AÃø¬°¯à¬°¡A¤~¯àª@µØ¦Û§Úªº¤H®æ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD