The original thread was getting a bit long To recap my .02, the web site itself is organized into a catalog with url links set by Product, i.e. "Gear" then page, class/group, then subclass. These links then list the items and if all items do not fit on a single page offer either a View All or Next anchor. The original post was specific to snowboards and the code below will obtain (1) The item name (2) a url link to the item itself (3) features for the item as extracted from the url link. I chose to create an in-memory recordset and persist it to XML as Boards.xml. There is a commented section in the code having to do with navigating to View All - I think I have a handle on that. The code is specific to the IE Browser, and should probably be done as HTTP requests to remove that restriction. In terms of the original OPS overall goals a lot more effort has to be put into the design. Stan
P.S. the OP wanted the data in Excel, but the XML recordset can easily be ported there, just wanted to see if this was going in the right direction. I attached the recordset I created in testing, you can unzip it and view in Notepad.
[vba]
Sub createlookup()
'variables use to create link for specific catalog items
'these are hard-coded, but could be derived from a lookup
cItem = "Boards"
cPage = "295"
cCat = "7"
cSub = "49"
cRef = "/c" & cCat & "/s" & cSub & "/"
'assign XML recordset based on Item
cXML = ActiveWorkbook.Path & "\" & cItem & ".xml"
If Dir(cXML) <> "" Then Kill (cXML)
'create in-memory recordset
Set oRS = CreateObject("Adodb.Recordset")
oRS.Fields.Append "Item", 200, 100
oRS.Fields.Append "Url", 200, 200
oRS.Fields.Append "Info", 202, 536870910
oRS.Open
cURL = "http://www.backcountry.com/store/group/" & cPage & "/c" & cCat & "/s" & cSub & "/"
Set oIE = CreateObject("InternetExplorer.Application")
oIE.Visible = True
oIE.navigate cURL
cLinks = ""
'Navigate to first page
While oIE.Busy Or oIE.readyState <> 4
DoEvents
Wend
While oIE.Document.readyState <> "complete"
DoEvents
Wend
'///////////////////////////////////////////////////////////
'cannot get this next section to work
'it will click and reload the page
'but the recordset will be blank
'uncomment and see for yourself
'For Each S In oIE.Document.Body.GetElementsByTagName("A")
' If UCase(S.innerText) = "VIEW ALL" Then
' S.Click
' Exit For
' End If
'Next
'While oIE.Busy Or oIE.readyState <> 4
' DoEvents
'Wend
'While oIE.Document.readyState <> "complete"
' DoEvents
'Wend
'/////////////////////////////////////////////////////////////////
'add specific item urls to recordset
For Each S In oIE.Document.Body.GetElementsByTagName("A")
If InStr(S.href, cRef) And S.GetAttribute("alt") <> "" Then
If InStr(S.href, "#rev") = 0 Then
If InStr(S.href, "id=") Then
If InStr(cLinks, S.href) = 0 Then
cLinks = cLinks & "/" & S.href
oRS.Addnew
oRS.Collect("Item") = S.GetAttribute("alt")
oRS.Collect("Url") = S.href
oRS.Update
End If
End If
End If
End If
Next
If oRS.RecordCount > 0 Then
oRS.MoveFirst
While Not oRS.EOF
oIE.navigate (oRS.Collect("Url"))
While oIE.Busy Or oIE.readyState <> 4
DoEvents
Wend
While oIE.Document.readyState <> "complete"
DoEvents
Wend
oRS.Collect("Info") = oIE.Document.Body.GetElementsByTagName("TABLE").Item(2).innerText
oRS.Update
oRS.MoveNext
Wend
End If
oIE.Quit
Set oIE = Nothing
'persist recordset as XML and close it
oRS.Save cXML, 1
oRS.Close
Set oRS = Nothing
End Sub
Sub webscrape()
cItem = "Boards"
cXML = ActiveWorkbook.Path & "\" & cItem & ".xml"
If Dir(cXML) = "" Then Exit Sub
Set oRS = CreateObject("Adodb.Recordset")
oRS.Open cXML, "Provider=MSPersist;", 1, 4, 256
MsgBox oRS.RecordCount
oRS.Close
Set oRS = Nothing
End Sub
[/vba]