-
Any of you guys familiar with web query...
I'm trying to do a web data-scraper using the .QueryTables method.
I did a data "web query" and ended up with this code. I was going to scrape the data onto a blank sheet and work with it from there, however this thing is already giving me an error, and I CANNOT find anything on the net to help....
[vba]Sub Query3()
'
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://search.har.com/engine/doSearch.cfm?QUICKSEARCH=802%20Hallmark%20Oak" _
, Destination:=Range("Import!$A$1"))
.Name = "doSearch.cfm?QUICKSEARCH=802%20Hallmark%20Oak"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.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
If Range("A15") = "Search Result: (0) Records Found. " Then
Sheets("Leads").Range("H209").Formula = "N/A"
Sheets("Leads").Range("I209").Formula = "N/A"
End If
End Sub[/vba]
It kicks it out on the first line (in red).
I've been playing with this thing for a month now. Any thoughts on this?
Thanks for listening...
-
It works for me if I have a sheet named Import. (Excel 2003)
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
-
Oh man. I had that duped in two different modules...it is working. Plus I had the button on the wrong page....switched it.
Oh this thing is cool. When I'm done automating this, it'll take 40 a month hours of work down to 20 seconds.
I might need more help in the future.
FYI - Ya'll have been great . As soon as I close these deals in 30 days or so, I'm going to hit the donate button real hard....I promise you that.
This has been invaluable.
-
If only all problems were so simple!
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules