| ©«¤l5923 ¥DÃD13 ºëµØ1 ¿n¤À5986 ÂI¦W0  §@·~¨t²Îwin10 ³nÅ骩¥»Office 2010 ¾\ŪÅv150 ©Ê§O¨k ¨Ó¦Û¥xÆW°ò¶© µù¥U®É¶¡2010-5-1 ³Ì«áµn¿ý2022-1-23 
         
 | 
                
| ¥»©«³Ì«á¥Ñ GBKEE ©ó 2013-3-30 16:06 ½s¿è 
 ¦^´_ 3# spermbank
 ¨C¤@ºô¶ªºªí³æ«Ø¸m¤£¤@¼Ë,»Ý¤@¤@¥h´M§ä½Æ»s¥N½X³oºô¶¦³×§ï±±¨î¶µ,2# ³o¨Çµ{¦¡½X¤£¾A¥Î, 4#ªºµ{¦¡½X¤wקאּ¥¿½T
 Ie.Document.ALL(632).Value = "sii"   '¤W¥« = sii,¤WÂd = otc,¿³Âd = rotc,¤½¶}µo¦æ = pub
 Ie.Document.ALL(643).Value = "101"   '¦~«×
 Ie.Document.ALL(650).Value = "04"    '²Ä¤@©u = 01,²Ä¤G©u = 02,²Ä¤T©u = 03,²Ä¥|©u = 04
 Ie.Document.ALL(667).Click
½Æ»s¥N½XOption Explicit
Sub ¤½¶}¸ê°TÆ[´ú¯¸()
    Dim ie As Object, xx, k, j, i, AA As Variant
    Dim T As Date, ¸ê°T As String
    Do
        ¸ê°T = InputBox("1: ·l¯qªí" & vbLf & "2: ¦X¨Ö·l¯qªí")   '¿ï¾Ü¤½¶}¸ê°TÆ[´ú¯¸ªºªí®æ
       '¸ê°T = InputBox("1: ·l¯qªí" & vbLf & "2: ¦X¨Ö·l¯qªí"& vbLf & "3: ???ªí"...............)
        If ¸ê°T = "" Then Exit Sub                              '¤£¿ï¾Üµ²§ôµ{¦¡
    Loop Until Val(¸ê°T) > 0 And Val(¸ê°T) <= 2 '                Val(¸ê°T)<=???  µ²§ô¿ï¾Üªí³æ
    ActiveSheet.Cells.Clear
    Application.DisplayStatusBar = True
    Application.StatusBar = "....... ºô¶¶}±Ò¤¤.......... "
    
  '  On Error GoTo ie_err
    Set ie = CreateObject("InternetExplorer.Application")
    ie.Navigate ¤U¸üºô§}(¸ê°T)
    Do While ie.Busy Or ie.ReadyState <> 4
            DoEvents
    Loop
    With ie.Document
        T = Time
        Do While ie.Busy Or ie.ReadyState <> 4
            If Time = T + #12:01:00 AM# Then GoTo ie_err                'µ¥Ôºô¶²§±`:µ²§ôµ{¦¡
            DoEvents
        Loop
        '**********  ×§ï³o¸Ì ªº¿ï¶µ
        .getelementbyID("TYPEK").Value = "sii"  '¤W¥« = sii,¤WÂd = otc,¿³Âd = rotc,¤½¶}µo¦æ = pub
        .getelementbyID("year").Value = "101"    '¦~«×
        .getelementbyID("season").Value = "02"    '²Ä¤@©u = 01,²Ä¤G©u = 02,²Ä¤T©u = 03,²Ä¥|©u = 04
        For i = 0 To .getelementsbytagname("input").Length - 1
            If .getelementsbytagname("input")(i).Type = "button" And .getelementsbytagname("input")(i).Value = " ·j´M " Then
                .getelementsbytagname("input")(i).Click
            End If
        Next
        µ¥«Ýºô¶
        Set AA = .getelementsbytagname("table")   '¸ê®Æ°Ï
    End With
    T = Time
    With ActiveSheet
        .Cells(1, "A") = IIf(¸ê°T = 1, "·l¯qªí", "¦X¨Ö·l¯qªí")
        .Cells(1, "B") = ¥«³õ§O(ie.Document.getelementbyID("TYPEK").Value)
        .Cells(1, "C") = ie.Document.getelementbyID("year").Value & "¦~«×"
        .Cells(1, "D") = ie.Document.getelementbyID("season").Value & "©u"
        .Cells(1).Select
        Application.ScreenUpdating = False
        k = 1
        On Error Resume Next
        For xx = ºô¶ªí®æ(¸ê°T) To AA.Length - 1
            For i = 0 To AA(xx).Rows.Length - 1      '¼g¤J¸ê®Æ
                k = k + 1
                For j = 0 To 19
                    Application.StatusBar = "¤U¸ü¸ê®Æ¤¤ ..." & k - 1
                    .Cells(k, j + 1) = AA(xx).Rows(i).Cells(j).innertext
                Next
            Next
        Next
        Set AA = .Range("S3:S" & .[S3].End(xlDown).Row)
        AA.Replace "°ò¥»¨CªÑ¬Õ¾l", "", xlWhole
        AA.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
        .Cells(.Rows.Count, 1).End(xlUp).EntireRow.Delete
        .Cells.EntireColumn.AutoFit
        .[A1].Select
    End With
    Application.ScreenUpdating = True
    ie.Quit
    Application.StatusBar = "¤U¸ü¸ê®Æ®É¶¡ : " & Format(Time - T, ["S¬í"])
    End
ie_err:
    ie.Quit
    MsgBox "ºô¶¦³°ÝÃD,½Ð«·s°õ¦æ..."
    End
¸ê°T_Err:
End Sub
Private Sub µ¥«Ýºô¶()    'µ¥«Ýºô¶¤U¸ü¸ê®Æ§¹²¦ªº®É¶¡
    Dim Tt(1 To 3) As Date
    Tt(1) = Time
    Tt(2) = Time
    Tt(3) = #12:00:10 AM#     '10¬í ½Õ¾ã³o¸Ì
    Do
        If Time > Tt(2) Then
            Application.StatusBar = "ºô¶¤U¸ü¤¤ ³Ñ¾l¬í¼Æ.. " & Second(Tt(1) + Tt(3) - Time)
            Tt(2) = Time
        End If
        DoEvents
    Loop Until Time > Tt(1) + Tt(3)
    Application.StatusBar = "¸ê®Æ¤U¸ü¤¤...."
End Sub
Private Function ¤U¸üºô§}(xWord As String) As String      '¶Ç¦^¿ï¾Üªººô§}
    Select Case xWord
        Case "1"
            ¤U¸üºô§} = "http://mops.twse.com.tw/mops/web/t51sb08" '·l¯qªí
        Case "2"
            ¤U¸üºô§} = "http://mops.twse.com.tw/mops/web/t51sb13" '¦X¨Ö·l¯qªí
        ''Case "3"     ·sºô¶ªººô§}
        ''
        ''
    End Select
End Function
Private Function ¥«³õ§O(xWord As String) As String
       '¤W¥« = sii,¤WÂd = otc,¿³Âd = rotc,¤½¶}µo¦æ = pub
    Select Case xWord
        Case "sii"
            ¥«³õ§O = "¤W¥«"
        Case "otc"
            ¥«³õ§O = "¤WÂd"
        Case "rotc"
            ¥«³õ§O = "¿³Âd"
        Case "pub"
            ¥«³õ§O = "¤½¶}µo¦æ"
    End Select
End Function
Private Function ºô¶ªí®æ(xWord As String) As Integer
    Select Case xWord
        Case "1"
            ºô¶ªí®æ = 13  '·l¯qªí
        Case "2"
            ºô¶ªí®æ = 12  '¦X¨Ö·l¯qªí
        
        ''¨C¤@ºô¶ªºªí³æ«Ø¸m¤£¤@¼Ë,»Ý¤@¤@¥h´M§ä
        '' ¦Û¦æ¬d¬Ý·s¼W Case "3"......
        ''
    End Select
End Function
 | 
 |