ExcelNewbi
New Member
- Joined
- May 31, 2011
- Messages
- 1
Hi Excel Experts,
I'm doing an Automated Query from a URL list in Excel & input queried selected result fields beside each address. The result fields selected is the URL's result table.
The URL home page is the same for the whole list. I did manage to do a CONCATENATE of the URL home page + search fields but got stuck at the query retrieve(selected fields) automation.
I have tried marco recordings in relative mode with some code tweakings and manage to come up with this :
Range(ActiveCell.Offset(0, 0)).Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;" & ActiveCell.Offset(0, 0).value, Destination:=Range(ActiveCell.Offset(0, 1)))
.Name = ActiveCell.Offset(0, 0).value
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = False
.RefreshOnFileOpen = False
.BackgroundQuery = False
.RefreshStyle = xlInsertEntireRows
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingRTF
.WebTables = "3"
.WebPreFormattedTextToColumns = False
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = True
.WebDisableDateRecognition = True
.WebDisableRedirections = True
.Refresh BackgroundQuery:=False
Algo : Select a Cell from the URL List , create 7 new rows below, query from the Web, Results send to the next column of the URL list beside the Cell selected.
With this code, I got an error messaging asking me to debug..
Would appreciate if anyone could help an Excel newb out Thank you.
I'm doing an Automated Query from a URL list in Excel & input queried selected result fields beside each address. The result fields selected is the URL's result table.
The URL home page is the same for the whole list. I did manage to do a CONCATENATE of the URL home page + search fields but got stuck at the query retrieve(selected fields) automation.
I have tried marco recordings in relative mode with some code tweakings and manage to come up with this :
Range(ActiveCell.Offset(0, 0)).Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;" & ActiveCell.Offset(0, 0).value, Destination:=Range(ActiveCell.Offset(0, 1)))
.Name = ActiveCell.Offset(0, 0).value
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = False
.RefreshOnFileOpen = False
.BackgroundQuery = False
.RefreshStyle = xlInsertEntireRows
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingRTF
.WebTables = "3"
.WebPreFormattedTextToColumns = False
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = True
.WebDisableDateRecognition = True
.WebDisableRedirections = True
.Refresh BackgroundQuery:=False
Algo : Select a Cell from the URL List , create 7 new rows below, query from the Web, Results send to the next column of the URL list beside the Cell selected.
With this code, I got an error messaging asking me to debug..
Would appreciate if anyone could help an Excel newb out Thank you.