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

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

¦^´_ 12# diabo

¤£À´­C!
¦]¬°¸ÓURª½±µÅã¥Ü¶Ã½X,©Ò¥H§Ú¤U¸ü¤]¬O¶Ã½X

½Ð°Ý±z»¡ªº¬O±Nµ{¦¡½X¼g¦bVBAùØÀY±Æ°£¶Ã½X°ÝÃD?!
¥i§_¥Ü½d?!

TOP

¦^´_ 11# HSIEN6001


    À˵øIEªº½s½X¡A¬O§_¿ï¾Ü¡u¦Û°Ê½s½X¡v......
diabo

TOP

¦^´_ 8# diabo

ÁÂÁÂ,³oUR¸Õ¹L¤F,¥i±¤§ì¤U¨Ó¤å¦r¬O¶Ã½X
G¤jªº´ú¸ÕOK,¦ýÁÙ¦³³\¦h¤£À´,µ¥«Ý«üÂI ^__^

TOP

¦^´_ 4# GBKEE


    G¤j±z¦n:
            
            ¤Q¤À·PÁ¤j¤jªº«ü±Ð¡A¸U¤À·P®¦¡A¦pªG¨S¦³¤j¤jªºÀ°¦£¡A§Úªºµ{¦¡¯uªº¤£ª¾¹D¦p¦ó¯à«e¶i
            ±q¥h¦~¥H¨Ó¡A§Ú³°Äò§Ú¦³«Ü¦h°ÝÃD¡A³£¬OG¤jªº¼ö¤ßÀ°¦£¡A§Úªº·Qªk¡A¤~¯àÂǥѵ{¦¡ºCºC°Â¥X·Q­nªºªF¦è
            ¯uªº¤Q¤À·P¿E

            ¤£¹LÁÙ¬O¦³´X­Ó°ÝÃD·Q°Ý ><"
            ºô­¶ªí®æ = 11
            ºô­¶ªí®æ = 12  '¦X¨Ö·l¯qªí
            ''¨C¤@ºô­¶ªºªí³æ«Ø¸m¤£¤@¼Ë,»Ý¤@¤@¥h´M§ä
            '' ¦Û¦æ¬d¬Ý·s¼W Case "3"......
           ½Ð°Ý¼Æ¦r11»P12­n¦p¦ó´M§ä?

          ¥t¥~¨â­Óºô­¶§Ú¤]·QŪ¤J
          http://mops.twse.com.tw/mops/web/t21sc04  '¨C¤ëÀç·~¦¬¤J²Î­p·JÁ`ªí¡A "¦¹ºô­¶·|¸õ¥X¥t¤@ºô­¶"
          http://mops.twse.com.tw/mops/web/t21sb06 '¨C¤ë¦X¨ÖÀç·~¦¬¤J²Î­p·JÁ`ªí
          §Ú¤S­n¦p¦ó¶×¤J©O? ÁÂÁ¡C

TOP

¦^´_ 1# spermbank
  1. Sub §ì°]³ø(°]³ø§O, ¥«³õ§O, ¦~, ©u)
  2.    
  3.     Select Case °]³ø§O
  4.         Case "·l¯q":     µ{¦¡ = "ajax_t51sb08"
  5.         Case "¸ê²£":     µ{¦¡ = "ajax_t51sb07"
  6.         Case "¦X¨Ö·l¯q": µ{¦¡ = "ajax_t51sb13"
  7.         Case "¦X¨Ö¸ê²£": µ{¦¡ = "ajax_t51sb12"
  8.     End Select
  9.    
  10.     Select Case ¥«³õ§O
  11.         Case "¤W¥«": ¥«³õ = "sii"
  12.         Case "¤WÂd": ¥«³õ = "otc"
  13.         Case "¿³Âd": ¥«³õ = "rotc"
  14.         Case "¤½¶}": ¥«³õ = "pub"
  15.     End Select
  16.    
  17.    '­ì©lºô§} http://mops.twse.com.tw/mops/web/ajax_t51sb07?encodeURIComponent=1&step=1&firstin=1&off=1&TYPEK=sii&year=101&season=04
  18.     theURL = "http://mops.twse.com.tw/mops/web/" & µ{¦¡ & "?encodeURIComponent=1&step=1&firstin=1&off=1&TYPEK=" & ¥«³õ & "&year=" & ¦~ & "&season=" & ©u
  19.    
  20.     With ActiveSheet.QueryTables.Add(Connection:="URL;" & theURL, Destination:=Range("A1"))
  21.         .Name = "§ì°]³ø"
  22.         .BackgroundQuery = True
  23.         .RefreshStyle = xlOverwriteCells
  24.         .RefreshPeriod = 0
  25.         .WebSelectionType = xlEntirePage
  26.         .WebFormatting = xlWebFormattingNone
  27.         .WebDisableDateRecognition = False
  28.         .WebDisableRedirections = False
  29.         .Refresh BackgroundQuery:=False
  30.         .Delete
  31.     End With
  32.    
  33. End Sub
½Æ»s¥N½X
1. ¥H¤Wµ{¦¡½X¶È§ì¸ê®Æ¡A¨Ã¥¼³B²zª÷¿Ä«OÀIÃÒ¨é...ÃþªÑ·|­p¬ì¥Ø¤£¦Pªº°ÝÃD
2. ¨Ï¥Î½d¨Ò  call §ì°]³ø( "·l¯q","¤WÂd",101,"04")
diabo

TOP

¦^´_ 5# HSIEN6001

¦P¤W¤@½g¦^ÂСA²¤Æ°ÝÃD±q·½ÀY¶}©l....

http://mops.twse.com.tw/mops/web/ajax_t56sb21?encodeURIComponent=1&run=Y&step=1&TYPEK=sii&year=102&smonth=01&emonth=03&sstep=1&firstin=true
diabo

TOP

¦^´_ 1# spermbank

«Øij±q¸ÑªR­ì©l¸ê®Æºô§}µÛ¤â¡A­Y¸Óºô­¶ª©­±³]­pÅܧó¡Aµ{¦¡½X¤£»Ý­×§ï¡A¤ñ¸û¤£®e©ö¨ü¨ì¼vÅT¡Cµ{¦¡½X¥Î¿ýªº(WEB¬d¸ß-Querytable)´N¥i¥H¨ú±o.....´N¤£¼g¤F....

¹ê¬IIFRS¤§«e[101¦~²Ä4©u(§t)¥H«e]

­Ó§O·l¯qªí
http://mops.twse.com.tw/mops/web/ajax_t51sb08?encodeURIComponent=1&step=1&firstin=1&off=1&TYPEK=sii&year=101&season=04

­Ó§O¸ê²£­t¶Åªí
http://mops.twse.com.tw/mops/web/ajax_t51sb07?encodeURIComponent=1&step=1&firstin=1&off=1&TYPEK=sii&year=101&season=04

¦X¨Ö·l¯qªí
http://mops.twse.com.tw/mops/web/ajax_t51sb13?encodeURIComponent=1&step=1&firstin=1&off=1&TYPEK=sii&year=101&season=04

¦X¨Ö¸ê²£­t¶Åªí
http://mops.twse.com.tw/mops/web/ajax_t51sb12?encodeURIComponent=1&step=1&firstin=1&off=1&TYPEK=sii&year=101&season=04

¤W¥« TYPEK=sii
¤WÂd TYPEK=otc
year = ¥Á°ê¦~, ¨Ò 102
season = ©u«×, ¨Ò 01, 02, 03, 04
diabo

TOP

¤£³]ªí®æ¦WºÙ(©ïÀY),¥H¤U¬O­×§ï³¡¤À¸ê®ÆÀ³¥Î
±æ½Ð­×¥¿¿ù»~,ÁÂÁÂ..^___^..
  1. Option Explicit
  2. Sub ¥Ó³øÂàÅý()
  3. Dim ie As Object, xx, k, j, i, AA As Variant
  4. Dim T As Date, ¸ê°T As String
  5.     Do
  6.         ¸ê°T = InputBox("1: ¾ú¥v«ùªÑÂàÅý" & vbLf & "2: ¦X¨Ö·l¯qªí")   '¿ï¾Ü¤½¶}¸ê°TÆ[´ú¯¸ªºªí®æ
  7.         If ¸ê°T = "" Then Exit Sub                              '¤£¿ï¾Üµ²§ôµ{¦¡
  8.     Loop Until Val(¸ê°T) > 0 And Val(¸ê°T) <= 2 '                Val(¸ê°T)<=???  µ²§ô¿ï¾Üªí³æ
  9.    
  10.     ActiveSheet.Cells.Clear
  11.     Application.DisplayStatusBar = True
  12.     Application.StatusBar = "....... ºô­¶¶}±Ò¤¤.......... "
  13.    
  14. 'On Error GoTo ie_err
  15. Set ie = CreateObject("InternetExplorer.Application")
  16. ie.Navigate ¤U¸üºô§}(¸ê°T)
  17.     Do While ie.Busy Or ie.ReadyState <> 4
  18.             DoEvents
  19.     Loop
  20.     With ie.Document
  21.         T = Time
  22.         Do While ie.Busy Or ie.ReadyState <> 4
  23.             If Time = T + #12:01:00 AM# Then GoTo ie_err                'µ¥­Ôºô­¶²§±`:µ²§ôµ{¦¡
  24.             DoEvents
  25.         Loop
  26.     '**********  ­×§ï³o¸Ì ªº¿ï¶µ
  27.     'http://mops.twse.com.tw/mops/web/t56sb21_q3?&step=0&firstin=1&off=1&TYPEK=sii&year=91&smonth=07&emonth=09
  28.    
  29.     .getelementbyID("TYPEK").Value = "sii"  '¤W¥« = sii,¤WÂd = otc,¿³Âd = rotc,¤½¶}µo¦æ = pub
  30.     .getelementbyID("year").Value = "91"    '¦~«×
  31.     .getelementbyID("smonth").Value = "07"  '°_¤ë¥÷
  32.     .getelementbyID("emonth").Value = "09"  '°W¤ë¥÷
  33.         For i = 0 To .getelementsbytagname("input").Length - 1
  34.             If .getelementsbytagname("input")(i).Type = "button" And .getelementsbytagname("input")(i).Value = " ·j´M " Then
  35.                 .getelementsbytagname("input")(i).Click
  36.             End If
  37.         Next
  38.         µ¥«Ýºô­¶
  39.         Set AA = .getelementsbytagname("table")   '¸ê®Æ°Ï
  40.     End With
  41.     T = Time
  42.     With ActiveSheet

  43.         .Cells(1).Select
  44.         Application.ScreenUpdating = False
  45.         k = 1
  46.         On Error Resume Next
  47.         For xx = ºô­¶ªí®æ(¸ê°T) To AA.Length - 1
  48.             For i = 0 To AA(xx).Rows.Length - 1      '¼g¤J¸ê®Æ
  49.                 k = k + 1
  50.                 For j = 0 To 19
  51.                     Application.StatusBar = "¤U¸ü¸ê®Æ¤¤ ..." & k - 1
  52.                     .Cells(k, j + 1) = AA(xx).Rows(i).Cells(j).innertext
  53.                 Next
  54.             Next
  55.         Next
  56.         Set AA = .Range("R3:R" & .[R3].End(xlDown).Row)
  57.         AA.Replace "¬O§_¥Ó³ø«ù", "", xlWhole
  58.         AA.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
  59.         .Cells(.Rows.Count, 1).End(xlUp).EntireRow.Delete
  60.         .Cells.EntireColumn.AutoFit
  61.         .[A1].Select
  62.     End With
  63.     Application.ScreenUpdating = True
  64.     ie.Quit
  65.     Application.StatusBar = "¤U¸ü¸ê®Æ®É¶¡ : " & Format(Time - T, ["S¬í"])
  66.     End
  67. ie_err:
  68.     ie.Quit
  69.     MsgBox "ºô­¶¦³°ÝÃD,½Ð­«·s°õ¦æ..."
  70.     End
  71. ¸ê°T_Err:
  72. End Sub
  73. Private Sub µ¥«Ýºô­¶()    'µ¥«Ýºô­¶¤U¸ü¸ê®Æ§¹²¦ªº®É¶¡
  74.     Dim Tt(1 To 3) As Date
  75.     Tt(1) = Time
  76.     Tt(2) = Time
  77.     Tt(3) = #12:00:10 AM#     '10¬í ½Õ¾ã³o¸Ì
  78.     Do
  79.         If Time > Tt(2) Then
  80.             Application.StatusBar = "ºô­¶¤U¸ü¤¤ ³Ñ¾l¬í¼Æ.. " & Second(Tt(1) + Tt(3) - Time)
  81.             Tt(2) = Time
  82.         End If
  83.         DoEvents
  84.     Loop Until Time > Tt(1) + Tt(3)
  85.     Application.StatusBar = "¸ê®Æ¤U¸ü¤¤...."
  86. End Sub
  87. Private Function ¤U¸üºô§}(xWord As String) As String      '¶Ç¦^¿ï¾Üªººô§}
  88.     Select Case xWord
  89.         Case "1"
  90.             ¤U¸üºô§} = "http://mops.twse.com.tw/mops/web/t56sb21_q3" '¾ú¥v«ùªÑÂàÅý
  91.         Case "2"
  92.             ¤U¸üºô§} = "http://mops.twse.com.tw/mops/web/t51sb13" '¦X¨Ö·l¯qªí
  93.         ''Case "3"     ·sºô­¶ªººô§}
  94.         ''
  95.         ''
  96.     End Select
  97. End Function
  98. Private Function ¥«³õ§O(xWord As String) As String
  99.        '¤W¥« = sii,¤WÂd = otc,¿³Âd = rotc,¤½¶}µo¦æ = pub
  100.     Select Case xWord
  101.         Case "sii"
  102.             ¥«³õ§O = "¤W¥«"
  103.         Case "otc"
  104.             ¥«³õ§O = "¤WÂd"
  105.         Case "rotc"
  106.             ¥«³õ§O = "¿³Âd"
  107.         Case "pub"
  108.             ¥«³õ§O = "¤½¶}µo¦æ"
  109.     End Select
  110. End Function
  111. Private Function ºô­¶ªí®æ(xWord As String) As Integer
  112.     Select Case xWord
  113.         Case "1"
  114.             ºô­¶ªí®æ = 11
  115.         Case "2"
  116.             ºô­¶ªí®æ = 12  '¦X¨Ö·l¯qªí
  117.         
  118.         ''¨C¤@ºô­¶ªºªí³æ«Ø¸m¤£¤@¼Ë,»Ý¤@¤@¥h´M§ä
  119.         '' ¦Û¦æ¬d¬Ý·s¼W Case "3"......
  120.         ''
  121.     End Select
  122. End Function
½Æ»s¥N½X

TOP

¦^´_ 4# GBKEE
            ºô­¶ªí®æ = 13  '·l¯qªí
            ºô­¶ªí®æ = 12  '¦X¨Ö·l¯qªí

½Ð°Ý13»P12¼Æ¾Ú¥Ñ¨Ó
­Y´«¦¨¤£¦Pªí®æ§Ú¸Ó­n¦p¦ó§PÂ_³o¼Æ­È?!
¨Ò¦p:http://mops.twse.com.tw/mops/web/t56sb21_q3

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2013-3-30 16:06 ½s¿è

¦^´_ 3# spermbank
  1. ³oºô­¶¦³­×§ï±±¨î¶µ,2# ³o¨Çµ{¦¡½X¤£¾A¥Î, 4#ªºµ{¦¡½X¤w­×§ï¬°¥¿½T
  2. Ie.Document.ALL(632).Value = "sii"   '¤W¥« = sii,¤WÂd = otc,¿³Âd = rotc,¤½¶}µo¦æ = pub
  3. Ie.Document.ALL(643).Value = "101"   '¦~«×
  4. Ie.Document.ALL(650).Value = "04"    '²Ä¤@©u = 01,²Ä¤G©u = 02,²Ä¤T©u = 03,²Ä¥|©u = 04
  5. Ie.Document.ALL(667).Click
½Æ»s¥N½X
¨C¤@ºô­¶ªºªí³æ«Ø¸m¤£¤@¼Ë,»Ý¤@¤@¥h´M§ä
  1. Option Explicit
  2. Sub ¤½¶}¸ê°TÆ[´ú¯¸()
  3.     Dim ie As Object, xx, k, j, i, AA As Variant
  4.     Dim T As Date, ¸ê°T As String
  5.     Do
  6.         ¸ê°T = InputBox("1: ·l¯qªí" & vbLf & "2: ¦X¨Ö·l¯qªí")   '¿ï¾Ü¤½¶}¸ê°TÆ[´ú¯¸ªºªí®æ
  7.        '¸ê°T = InputBox("1: ·l¯qªí" & vbLf & "2: ¦X¨Ö·l¯qªí"& vbLf & "3: ???ªí"...............)
  8.         If ¸ê°T = "" Then Exit Sub                              '¤£¿ï¾Üµ²§ôµ{¦¡
  9.     Loop Until Val(¸ê°T) > 0 And Val(¸ê°T) <= 2 '                Val(¸ê°T)<=???  µ²§ô¿ï¾Üªí³æ
  10.     ActiveSheet.Cells.Clear
  11.     Application.DisplayStatusBar = True
  12.     Application.StatusBar = "....... ºô­¶¶}±Ò¤¤.......... "
  13.    
  14.   '  On Error GoTo ie_err
  15.     Set ie = CreateObject("InternetExplorer.Application")
  16.     ie.Navigate ¤U¸üºô§}(¸ê°T)
  17.     Do While ie.Busy Or ie.ReadyState <> 4
  18.             DoEvents
  19.     Loop
  20.     With ie.Document
  21.         T = Time
  22.         Do While ie.Busy Or ie.ReadyState <> 4
  23.             If Time = T + #12:01:00 AM# Then GoTo ie_err                'µ¥­Ôºô­¶²§±`:µ²§ôµ{¦¡
  24.             DoEvents
  25.         Loop
  26.         '**********  ­×§ï³o¸Ì ªº¿ï¶µ
  27.         .getelementbyID("TYPEK").Value = "sii"  '¤W¥« = sii,¤WÂd = otc,¿³Âd = rotc,¤½¶}µo¦æ = pub
  28.         .getelementbyID("year").Value = "101"    '¦~«×
  29.         .getelementbyID("season").Value = "02"    '²Ä¤@©u = 01,²Ä¤G©u = 02,²Ä¤T©u = 03,²Ä¥|©u = 04
  30.         For i = 0 To .getelementsbytagname("input").Length - 1
  31.             If .getelementsbytagname("input")(i).Type = "button" And .getelementsbytagname("input")(i).Value = " ·j´M " Then
  32.                 .getelementsbytagname("input")(i).Click
  33.             End If
  34.         Next
  35.         µ¥«Ýºô­¶
  36.         Set AA = .getelementsbytagname("table")   '¸ê®Æ°Ï
  37.     End With
  38.     T = Time
  39.     With ActiveSheet
  40.         .Cells(1, "A") = IIf(¸ê°T = 1, "·l¯qªí", "¦X¨Ö·l¯qªí")
  41.         .Cells(1, "B") = ¥«³õ§O(ie.Document.getelementbyID("TYPEK").Value)
  42.         .Cells(1, "C") = ie.Document.getelementbyID("year").Value & "¦~«×"
  43.         .Cells(1, "D") = ie.Document.getelementbyID("season").Value & "©u"
  44.         .Cells(1).Select
  45.         Application.ScreenUpdating = False
  46.         k = 1
  47.         On Error Resume Next
  48.         For xx = ºô­¶ªí®æ(¸ê°T) To AA.Length - 1
  49.             For i = 0 To AA(xx).Rows.Length - 1      '¼g¤J¸ê®Æ
  50.                 k = k + 1
  51.                 For j = 0 To 19
  52.                     Application.StatusBar = "¤U¸ü¸ê®Æ¤¤ ..." & k - 1
  53.                     .Cells(k, j + 1) = AA(xx).Rows(i).Cells(j).innertext
  54.                 Next
  55.             Next
  56.         Next
  57.         Set AA = .Range("S3:S" & .[S3].End(xlDown).Row)
  58.         AA.Replace "°ò¥»¨CªÑ¬Õ¾l", "", xlWhole
  59.         AA.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
  60.         .Cells(.Rows.Count, 1).End(xlUp).EntireRow.Delete
  61.         .Cells.EntireColumn.AutoFit
  62.         .[A1].Select
  63.     End With
  64.     Application.ScreenUpdating = True
  65.     ie.Quit
  66.     Application.StatusBar = "¤U¸ü¸ê®Æ®É¶¡ : " & Format(Time - T, ["S¬í"])
  67.     End
  68. ie_err:
  69.     ie.Quit
  70.     MsgBox "ºô­¶¦³°ÝÃD,½Ð­«·s°õ¦æ..."
  71.     End
  72. ¸ê°T_Err:
  73. End Sub
  74. Private Sub µ¥«Ýºô­¶()    'µ¥«Ýºô­¶¤U¸ü¸ê®Æ§¹²¦ªº®É¶¡
  75.     Dim Tt(1 To 3) As Date
  76.     Tt(1) = Time
  77.     Tt(2) = Time
  78.     Tt(3) = #12:00:10 AM#     '10¬í ½Õ¾ã³o¸Ì
  79.     Do
  80.         If Time > Tt(2) Then
  81.             Application.StatusBar = "ºô­¶¤U¸ü¤¤ ³Ñ¾l¬í¼Æ.. " & Second(Tt(1) + Tt(3) - Time)
  82.             Tt(2) = Time
  83.         End If
  84.         DoEvents
  85.     Loop Until Time > Tt(1) + Tt(3)
  86.     Application.StatusBar = "¸ê®Æ¤U¸ü¤¤...."
  87. End Sub
  88. Private Function ¤U¸üºô§}(xWord As String) As String      '¶Ç¦^¿ï¾Üªººô§}
  89.     Select Case xWord
  90.         Case "1"
  91.             ¤U¸üºô§} = "http://mops.twse.com.tw/mops/web/t51sb08" '·l¯qªí
  92.         Case "2"
  93.             ¤U¸üºô§} = "http://mops.twse.com.tw/mops/web/t51sb13" '¦X¨Ö·l¯qªí
  94.         ''Case "3"     ·sºô­¶ªººô§}
  95.         ''
  96.         ''
  97.     End Select
  98. End Function
  99. Private Function ¥«³õ§O(xWord As String) As String
  100.        '¤W¥« = sii,¤WÂd = otc,¿³Âd = rotc,¤½¶}µo¦æ = pub
  101.     Select Case xWord
  102.         Case "sii"
  103.             ¥«³õ§O = "¤W¥«"
  104.         Case "otc"
  105.             ¥«³õ§O = "¤WÂd"
  106.         Case "rotc"
  107.             ¥«³õ§O = "¿³Âd"
  108.         Case "pub"
  109.             ¥«³õ§O = "¤½¶}µo¦æ"
  110.     End Select
  111. End Function
  112. Private Function ºô­¶ªí®æ(xWord As String) As Integer
  113.     Select Case xWord
  114.         Case "1"
  115.             ºô­¶ªí®æ = 13  '·l¯qªí
  116.         Case "2"
  117.             ºô­¶ªí®æ = 12  '¦X¨Ö·l¯qªí
  118.         
  119.         ''¨C¤@ºô­¶ªºªí³æ«Ø¸m¤£¤@¼Ë,»Ý¤@¤@¥h´M§ä
  120.         '' ¦Û¦æ¬d¬Ý·s¼W Case "3"......
  121.         ''
  122.     End Select
  123. End Function
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : §Ú­Ì³Ì¤jªº¼Ä¤H¤£¬O§O¤H¡D¥i¯à¬O¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD