Tgaboreau90
New Member
- Joined
- May 25, 2012
- Messages
- 26
I have written a macro that will go to a url which is defined by the a reference number in a cell. and return the contents of a table from that webpage.
Here is a part of it...
my problem is that i have do this a lot of times and some of the pages are slightly different. so defining the table with an index ("webtables = "18") will not do because the table i am looking for is not always the 18th table.
does anybody know if i can define the table with a name instead of an index and how would i find find which name i need to use and what syntax?
thank you.
Here is a part of it...
Code:
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;" & Range("A1").Value & ActiveCell.Value, Destination:=ActiveCell.Offset(-1, 1))
.Name = Range("A2").Value & ActiveCell.Value
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
[U] [B] .WebTables = "18"[/B][/U]
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
my problem is that i have do this a lot of times and some of the pages are slightly different. so defining the table with an index ("webtables = "18") will not do because the table i am looking for is not always the 18th table.
does anybody know if i can define the table with a name instead of an index and how would i find find which name i need to use and what syntax?
thank you.