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

Web ¸ê®Æ ¶×¤J °ÝÃD

¦^´_ 2# seemee
  1. Sub ­ÓªÑ¥æ©ö©ú²Ó¤U¸ü()
  2.     Dim ªÑ²¼¥N¸¹ As String, ¦~ As String, ¤ë As String, N As Name, i As Integer, T As Integer, A
  3.     ¦~ = 2013
  4.     ¤ë = 1
  5.     ¤ë = Format(¤ë, "00")
  6.     ªÑ²¼¥N¸¹ = 2330
  7.    
  8.     T = Time
  9.     With ActiveSheet
  10.         .Cells.Clear
  11.         DoEvents
  12.         'Application.ScreenUpdating = False
  13.         'Application.StatusBar = False
  14.         With .QueryTables.Add(Connection:="URL;http://www.twse.com.tw/ch/trading/exchange/STOCK_DAY/genpage/Report" & ¦~ & ¤ë & "/" & ¦~ & ¤ë & "_F3_1_8_" & ªÑ²¼¥N¸¹ & ".php?STK_NO=" & ªÑ²¼¥N¸¹ & "&myear=" & ¦~ & "&mmon=" & ¤ë, Destination:=Range("A1"))
  15.             .BackgroundQuery = True
  16.             .WebTables = "8"
  17.             .Refresh BackgroundQuery:=False
  18.             ActiveSheet.Names(.Name).Delete
  19.         End With
  20.         ¤ë = 2
  21.         
  22.         Do
  23.              ¤ë = Format(¤ë, "00")
  24.             .Cells(.Rows.Count, 1).End(xlUp).Offset(1).Select
  25.             With .QueryTables.Add(Connection:="URL;http://www.twse.com.tw/ch/trading/exchange/STOCK_DAY/genpage/Report" & ¦~ & ¤ë & "/" & ¦~ & ¤ë & "_F3_1_8_" & ªÑ²¼¥N¸¹ & ".php?STK_NO=" & ªÑ²¼¥N¸¹ & "&myear=" & ¦~ & "&mmon=" & ¤ë, Destination:=Selection)
  26.                 .BackgroundQuery = True
  27.                 .WebTables = "8"
  28.                 On Error Resume Next
  29.                 Do
  30.                      Err.Clear
  31.                 .Refresh BackgroundQuery:=False
  32.                 If Err.Number = 1004 Then GoTo 10 'µLªk¶}±ÒÀÉ®×´N¸õ¨ì¤U¤@¤ë
  33.                 Loop Until Err.Number = 0
  34.                 On Error GoTo 0
  35.                 If Application.CountA(.ResultRange) = 0 Then GoTo OUT
  36.                 .ResultRange.Rows("1:2").Delete '§R°£1:2¦C
  37.                 ActiveSheet.Names(.Name).Delete
  38. 10
  39.                 ¤ë = ¤ë + 1
  40.             End With
  41.         Loop Until ¤ë > 12
  42. OUT:
  43.         .[A1].Select
  44.         Application.ScreenUpdating = True
  45.         With .UsedRange
  46.             .WrapText = False
  47.             .Interior.ColorIndex = xlNone
  48.             .Font.Size = 12
  49.             .Columns.AutoFit
  50.             A = CreateObject("WScript.Shell").popup("¦@¤U¸ü " & i & " ­¶¶O®É  " & Format(Time - T, "hh:mm¤ÀSS¬í"), 5, ¦~ & "_" & ªÑ²¼¥N¸¹, 48 + 0)
  51.             Application.StatusBar = ¦~ & " _ " & ªÑ²¼¥N¸¹ & " ¦@¤U¸ü " & i & "­¶ ¶O®É " & Format(Time - T, "HH:MM:SS")
  52.         End With
  53.         For Each N In .Names
  54.             N.Delete
  55.         Next
  56.      End With
  57. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

        ÀR«ä¦Û¦b : §Ú­Ì­n°µ¦nªÀ·|ªºÀô«O¡A¤]­n°µ¦n¤º¤ßªºÀô«O¡C
ªð¦^¦Cªí ¤W¤@¥DÃD