Help for (with ActiveSheet.QueryTables.Add Connec)
Sub WebQuery()
Dim strSearch As String
strSearch = "abc"
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.xyz.com/&=" & strSearch & "", _
Destination:=Range("A1"))
.Name = "search?hl=en&ie=UTF-8&oe=UTF-8&q=" & strSearch & ""
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = False
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlAllTables
.WebFormatting = xlWebFormattingAll
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.Refresh BackgroundQuery:=False
End With
End Sub
************************************************** ********
Hi I want to import data from website. wht the problem is for first time the code run sucessfully but for second time it gives error at :
, Destination:=Range("A1"))
Error Description : Method 'Range' of object '_Global' failed. i.e
Run Time Error 1004.
wht I m doing is I have a list of argument every time it take one argument frm list then it goes to internet collect data from website and paste in Excel sheet then I transfer tht data to Access and clear the Excel sheet and save it after that it takes second argument and goes to internet at this time it gives above mentioned error..
Please help me with the same..
************************************************** ********
|