我一直在嘗試幾天從ebay下載非免費送貨費用。我有頁面的項目編號。鏈接應該在ebay上進入正確的頁面。在嘗試轉到頁面並下載數據時,Excel掛起並且從不恢復。我真的需要這些運費,基本上是時間。如果這段代碼不能修復而不能掛起,有人可以告訴我如何獲取我需要的信息到Excel中嗎?我有其他的代碼可以從ebay上得到許多頁面上的易趣項目編號,這與其實非常相似,並且效果很好。我需要通過Excel 2010 VBA下載eBay運輸費用?
itemNumberAlone = Range("a" & eachItem).Value
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.ebay.com/itm/" & itemNumberAlone & "?ru=http%3A%2F%2Fwww.ebay.com%2Fsch%2Fi.html%3F_from%3DR40%26_sacat%3D0%26_nkw%3D" & itemNumberAlone & "%26_rdc%3D1" _
, Destination:=Range("$bZ$1"))
.Name = "second ebay links"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = True
.BackgroundQuery = True
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
Do While Not IsError(Application.Match("Shipping and handling", Range("bz1:bz1000"), 0))
If IsError(Application.Match("Shipping and handling", Range("bz1:bz1000"), 0)) Then Exit Do
If Not IsError(Application.Match("Shipping and handling", Range("bz1:bz1000"), 0)) Then
shippingRow = Application.Match("Shipping and handling", Range("bz1:bz1000"), 0) + 1
shippingCell = Range("bz" & shippingRow).Value
If Left(shippingCell, 2) <> "US" Then
Range("bz" & shippingRow - 1).ClearContents
Else
Range("c" & eachItem).Value = Right(shippingCell, Len(shippingCell) - 2)
End If
End If
Loop
End If
Next
我不認爲這是所有的代碼,其中是否定義了每個項目? – majjam
我在變量聲明中添加了代碼,對我來說代碼似乎很好。雖然我使用的是Excel 2003,但是您可以選擇嘗試嗎?你有沒有可以提供的錯誤信息?你有可能被eBay封鎖了嗎? – majjam
這可能會有所幫助,如何解決Excel中的崩潰/掛起問題:http://support.microsoft.com/kb/2758592 – majjam