Board logo

標題: 我要如何增進效能呢? [打印本頁]

作者: amg8885    時間: 2013-8-21 12:34     標題: 我要如何增進效能呢?

之前我抓取的網頁是呈現一般"白底黑字"畫面時程式跑起來很快,1秒約2筆,但現在的網頁變成"黑底白字"後,速度變得好慢,抓一筆要15~20秒,請問版上大大要如何調整修正呢?
以下是之前的程式~~~

Sub Ex()
  Dim i As Long, Ur$, Rng As Range, R As Long
  For i = 1 To 123457 
    Ur = "007CD" & Format(i, "000000") '
    R = ActiveSheet.UsedRange.Rows.Count
    Set Rng = ActiveSheet.Range("A" & IIf(R = 1, 0, R) + 1)
    With ActiveSheet.QueryTables.Add(Connection:= _
      "URL;http://OOXXOOXX./prn_evi_detail.asp?APPLYCODE=" & Ur _
        , Destination:=Rng)
      .Name = "prn_evi_detail.asp?APPLYCODE=" & Ur
      .FieldNames = True
      .RowNumbers = False
      .FillAdjacentFormulas = False
      .PreserveFormatting = True
      .RefreshOnFileOpen = False
      .BackgroundQuery = True
      .RefreshStyle = xlInsertDeleteCells
      .SavePassword = False
      .SaveData = True
      .AdjustColumnWidth = True
      .RefreshPeriod = 0
      .WebSelectionType = xlSpecifiedTables
      .WebFormatting = xlWebFormattingNone
      .WebTables = "2"
      .WebPreFormattedTextToColumns = True
      .WebConsecutiveDelimitersAsOne = True
      .WebSingleBlockTextImport = False
      .WebDisableDateRecognition = False
      .WebDisableRedirections = False
      .Refresh BackgroundQuery:=False
    End With
  Next
End Sub



--------------------------------------------------------------------------------




歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)