- ©«¤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
|
¦^´_ 10# lalalada
.WebTables = "4,""table2"""
קï9#¦p¤U- Option Explicit
- Sub Ӫѥæ©ö©ú²Ó¤U¸ü()
- Dim ªÑ²¼¥N¸¹ As String, N As Name, i As Integer, T As Date, A
- Do While ªÑ²¼¥N¸¹ = ""
- ªÑ²¼¥N¸¹ = InputBox("ªÑ²¼¥N¸¹", "¿é¤J¬d¸ß¤§ªÑ²¼¥N¸¹", "1101")
- If ªÑ²¼¥N¸¹ = "" Then End
- Loop
- T = Time
- With ActiveSheet
- .Cells.Clear
- DoEvents
- Application.ScreenUpdating = False
- Application.StatusBar = False
- With .QueryTables.Add(Connection:="URL;http://bsr.twse.com.tw/bshtm/bsContent.aspx?StartNumber=" & ªÑ²¼¥N¸¹ & "&FocusIndex=1", Destination:=Range("A1"))
- .WebFormatting = xlWebFormattingNone
- .WebTables = "4,""table2"""
- .Refresh BackgroundQuery:=False
- If Application.CountA(.ResultRange) = 0 Then
- MsgBox "ªÑ²¼¥N¸¹:" & ªÑ²¼¥N¸¹ & " ¿ù»~ !!!"
- [a1].Select
- End
- End If
- ActiveSheet.Names(.Name).Delete
- End With
- i = 2
- Do
- .Cells(.Rows.Count, 1).End(xlUp).Offset(1).Select
- With .QueryTables.Add(Connection:="URL;http://bsr.twse.com.tw/bshtm/bsContent.aspx?StartNumber=" & ªÑ²¼¥N¸¹ & "&FocusIndex=" & i, Destination:=Selection)
- .WebFormatting = xlWebFormattingNone
- .WebTables = "table2"
- On Error Resume Next
- Do
- Err.Clear
- .Refresh BackgroundQuery:=False
- Loop Until Err.Number = 0
- On Error GoTo 0
- If Application.CountA(.ResultRange) = 0 Then GoTo OUT
- .ResultRange(1).EntireRow.Delete
- ActiveSheet.Names(.Name).Delete
- i = i + 1
- End With
- Loop
- OUT:
- .[a1].Select
- Application.ScreenUpdating = True
- .Columns.AutoFit
- A = CreateObject("WScript.Shell").popup("¦@¤U¸ü " & i & " ¶¶O®É " & Format(Time - T, "hh:mm¤ÀSS¬í"), 5, "_" & ªÑ²¼¥N¸¹, 48 + 0)
- Application.StatusBar = "ªÑ²¼¥N¸¹ [" & ªÑ²¼¥N¸¹ & "] ¦@¤U¸ü " & i & "¶ ¶O®É " & Format(Time - T, "HH:MM:SS")
- For Each N In .Names
- N.Delete
- Next
- End With
- End Sub
½Æ»s¥N½X |
|