- ©«¤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
|
¦^´_ 13# joey0415
µ¹§A°Ñ¦Ò- Option Explicit
- Sub ªÑ²¼¤é³øªí() '¬d¸ß³æ¤@ªÑ²¼
- Dim ªÑ²¼¥N¸¹ As String, ¶¼Æ As String, T As Date
- Do While ªÑ²¼¥N¸¹ = ""
- ªÑ²¼¥N¸¹ = InputBox("ªÑ²¼¥N¸¹", "¿é¤J¬d¸ß¤§ªÑ²¼¥N¸¹", "1101")
- If ªÑ²¼¥N¸¹ = "" Then End
- Loop
- T = Time
- ¶¼Æ = ³øªí¶¼Æ(ªÑ²¼¥N¸¹)
- If ¶¼Æ <> "" Then
- ¶×¤J¤é³øªí ªÑ²¼¥N¸¹, ¶¼Æ
- MsgBox Format(Time - T, "§¹¦¨ ¶O®É HH:MM:SS")
- Else
- MsgBox "ªÑ²¼¥N¸¹ " & ªÑ²¼¥N¸¹ & " ¦³»~ !!!"
- End If
- End Sub
- Private Sub ¶×¤J¤é³øªí(ªÑ²¼¥N¸¹ As String, ¶¼Æ As String) '°Ñ¼Æ¶Ç°e¨Óªº --ªÑ²¼¥N¸¹ & ¶¼Æ
- Dim Rng As Range
- With ActiveSheet
- If .QueryTables.Count = 0 Then
- With .QueryTables.Add("URL;about:Tabs", .[A1])
- .Refresh BackgroundQuery:=False
- End With
- End If
- With .QueryTables(1)
- .Connection = "URl;http://bsr.twse.com.tw/bshtm/bsContent.aspx?StartNumber=" & ªÑ²¼¥N¸¹ & "&FocusIndex=All_" & ¶¼Æ
- .WebFormatting = xlWebFormattingNone
- .WebTables = "4,""table2"""
- .Refresh False
- End With
- Set Rng = .UsedRange.Offset(6)
- With Rng.Columns("A")
- .Replace "§Ç", "=Why", xlWhole
- .SpecialCells(xlCellTypeFormulas, xlErrors).Value = ""
- .SpecialCells(xlCellTypeBlanks).EntireRow.Delete
- End With
- .Cells(1).Select
- End With
- End Sub
- Private Function ³øªí¶¼Æ(ªÑ²¼¥N¸¹ As String) '°Ñ¼Æ¶Ç°e¨Óªº --ªÑ²¼¥N¸¹
- With CreateObject("InternetExplorer.Application")
- .Navigate "http://bsr.twse.com.tw/bshtm/bsMenu.aspx"
- Do While .Busy Or .readyState <> 4
- DoEvents
- Loop
- .document.getElementsByName("txtTASKNO").Item(0).Value = ªÑ²¼¥N¸¹
- .document.getElementsByName("btnOK")(0).Click
- Do While .Busy Or .readyState <> 4
- DoEvents
- Loop
- ³øªí¶¼Æ = .document.getElementsByName("sp_ListCount")(0).innertext
- .Quit
- End With
- End Function
½Æ»s¥N½X |
|