DKeller100
New Member
- Joined
- Feb 15, 2009
- Messages
- 14
I have written some code to loop through a series of web pages (my thanks to this board for getting me started on the process) and am having some problem with the placement of the resulting page.
Here's the snippet:
For i = 2 To m
Set qt = ActiveSheet.QueryTables.Add(Connection:="URL;" & URL & urlquery, Destination:=Cells(1, 1))
With qt
.FieldNames = False
.RefreshStyle = xlInsertDeleteCells
.RowNumbers = False
.FillAdjacentFormulas = False
.RefreshOnFileOpen = False
.HasAutoFormat = True
.BackgroundQuery = True
.TablesOnlyFromHTML = True
.Refresh BackgroundQuery:=False
.SavePassword = False
.SaveData = False
z = z + 20
End With
Despite the Destination:=Cells(1, 1)), which should place following sheets directly after the last data line, the query still places the results in A1 thereby erasing the previous sheets data.
I have tried the RefreshStyle property :
.RefreshStyle = xlInsertRows
with the same results. Is there another property I'm missing?
Also any suggestions as to how I might be selective of the tables imported would be helpful. In a query file I can say Selection=. How might I incorporate that into a dynamic call?
Here's the snippet:
For i = 2 To m
Set qt = ActiveSheet.QueryTables.Add(Connection:="URL;" & URL & urlquery, Destination:=Cells(1, 1))
With qt
.FieldNames = False
.RefreshStyle = xlInsertDeleteCells
.RowNumbers = False
.FillAdjacentFormulas = False
.RefreshOnFileOpen = False
.HasAutoFormat = True
.BackgroundQuery = True
.TablesOnlyFromHTML = True
.Refresh BackgroundQuery:=False
.SavePassword = False
.SaveData = False
z = z + 20
End With
Despite the Destination:=Cells(1, 1)), which should place following sheets directly after the last data line, the query still places the results in A1 thereby erasing the previous sheets data.
I have tried the RefreshStyle property :
.RefreshStyle = xlInsertRows
with the same results. Is there another property I'm missing?
Also any suggestions as to how I might be selective of the tables imported would be helpful. In a query file I can say Selection=. How might I incorporate that into a dynamic call?