- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
        
|
¥»©«³Ì«á¥Ñ GBKEE ©ó 2016-4-18 10:50 ½s¿è
¦^´_ 1# laieven
¸Õ¸Õ¬Ý- Option Explicit
- Sub Ex_Àç¯q¤ÀªR¬d¸ß·JÁ`ªí() '¤½¶}¸ê°TÆ[´ú¯¸
- Dim i As Variant, E As Object, Op As String, Sh As Worksheet, R As Integer, C As Integer
- Application.StatusBar = "'** µ¥Ôºô¶ ....**"
- With CreateObject("InternetExplorer.Application")
- ' .Visible = True
- .Navigate "http://mops.twse.com.tw/mops/web/t163sb06"
- Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
- '[¤W¥«§O] *****
- With .document.ALL("TYPEK")(1)
- For i = 0 To .ALL.Length - 1
- Op = Op & vbLf & i + 1 & .ALL(i).INNERTEXT
- Next
- DoEvents ' ** ¦^¨ì Excel
- Do
- Application.ActiveWindow.Activate
- i = Application.InputBox(Op, "Àç¯q¤ÀªR¬d¸ß·JÁ`ªí [¤W¥«§O]", 1, Type:=1)
-
- If i = 0 Then GoTo Exit_Sub
- Loop Until i <= .ALL.Length And i >= 1
- .selectedindex = i - 1
- End With
- '[¦~«×] *****
- Do
- i = Application.InputBox(Format(Date, "ee"), "Àç¯q¤ÀªR¬d¸ß·JÁ`ªí [¦~«×]", Format(Date, "ee") - 1, Type:=1)
- If i = 0 Then GoTo Exit_Sub
- Loop Until i <= Format(Date, "ee")
- .document.ALL("year").Value = i
- '[©u§O] *****
- Do
- i = Application.InputBox(1, "Àç¯q¤ÀªR¬d¸ß·JÁ`ªí [©u§O]", DatePart("q", Date), Type:=1)
- If i = 0 Then GoTo Exit_Sub
- Loop Until i <= 4 And i >= 1
- .document.ALL("season").selectedindex = i
- '** ºô¶ «ö¤U [·j´M]
- For Each E In .document.ALL.tags("INPUT")
- If E.Value = " ·j´M " Then
- E.Click
- Exit For
- End If
- Next
- '** µ¥Ôºô¶ ¸ü¤J¸ê®Æ
- Application.StatusBar = "'** µ¥Ôºô¶ ¸ü¤J¸ê®Æ**"
- Do
- Set E = .document.BODY.ALL.tags("table")(11).Rows
- If InStr(.document.BODY.INNERTEXT, "¬d¸ßµL¸ê®Æ") Then
- MsgBox "¬d¸ßµL¸ê®Æ"
- Application.StatusBar = "** ºô¶ ¬d¸ßµL¸ê®Æ**"
- GoTo Exit_Sub:
- End If
- DoEvents:
- Loop Until E.Length > 11
- '** ¤U¸ü ¸ê®Æ
- Set Sh = Sheets(2) '«ü©w ¤u§@ªí
- Application.ScreenUpdating = False
- Application.StatusBar = "'** ¸ü¤J¸ê®Æ ¤¤ **"
- Set E = .document.BODY.ALL.tags("table")(11).Rows
-
- Sh.UsedRange.Clear
- For R = 0 To E.Length - 1
- For C = 0 To E(R).Cells.Length - 1
- If R > 1 And E(R).Cells(0).INNERTEXT = "¤½¥q¥N¸¹" Then Exit For
- Sh.Cells(R + 1, C + 1) = E(R).Cells(C).INNERTEXT
- Next
- Next
- Sh.UsedRange.SpecialCells(xlCellTypeBlanks).Delete
- Sh.Activate
- Sh.[A1].Select
- Application.ScreenUpdating = True
- Application.StatusBar = .document.BODY.ALL.tags("table")(12).INNERTEXT
- Exit_Sub:
- .Quit 'Ãö³¬ºô¶
- End With
- End Sub
½Æ»s¥N½X |
|