0
我對編寫VBA宏相對比較陌生。我寫了一個簡單的宏來從網站搜索中抓取數據。我希望根據單元格「sheet1」中的單元格內容循環搜索。搜索運行良好,但似乎沒有使用單元格內容。我不知道我需要做些什麼才能正常工作。您的幫助將不勝感激Excel VBA:在網頁搜索中使用單元格內容
Sub Get_internet_data()
For x = 1 To 3
Worksheets("Sheet1").Select
Worksheets("Sheet1").Activate
MySearch = "URL;http://www.trademe.co.nz/browse/categoryattributesearchresults.aspx?144=-1&144=-1&search=1&sidebar=1&cid=5000&rptpath=5000-"
MySearch = Cells(x, 1)
With ActiveSheet.QueryTables.Add(Connection:="URL;http://www.trademe.co.nz/browse/categoryattributesearchresults.aspx?MySearch", Destination:=Range("$C$6"))
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = False
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = False
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
Next x
End Sub
嘗試改變'字符串 「網址; HTTP://www.trademe.co.nz/browse/categoryattributesearchresults.aspx MYSEARCH」'到'「URL; http://www.trademe.co.nz/browse/categoryattributesearchresults.aspx?」 &MySearch' –