You are modifying my code!!! I recognize my style. Use the ID=dd2 to get
the object
Sub BackShellWorld()
URL = "http://www.backshellworld.com/crossreference.aspx"
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
Set IE2 = CreateObject("InternetExplorer.Application")
IE2.Visible = True
'get web page
IE.Navigate2 URL
Do While IE.readystate < 4 Or _
IE.busy = True
DoEvents
Loop
Call Dump(IE)
Set SelectComp = IE.document.getelementbyid("dd2")
For Each Comp In SelectComp
MsgBox (Comp.innertext)
Next Comp
End Sub
Sub Dump(IE)
'test code
With Sheets("Dump")
.Cells.ClearContents
RowCount = 1
For Each itm In IE.document.all
.Range("A" & RowCount) = itm.tagname
.Range("B" & RowCount) = itm.ID
.Range("C" & RowCount) = itm.classname
.Range("D" & RowCount) = Left(itm.innertext, 1024)
RowCount = RowCount + 1
Next itm
End With
End Sub
"dan dungan" wrote:
Hi,
I'm using Excel 2000 on Windows XP.
I'm attempting to retrieve data from
http://www.backshellworld.com/crossreference.aspx.
I copied the code below, and I'm trying to modify it to select the
dropdown lists, but
I'm missing something.
Are there any suggestions?
Thanks,
Dan
Case "ElectroAdapter"
If itm.tagname = "Script" Then
State = "GetData"
End If
Case "GetData"
If itm.tagname = "H2" Then
'get next section of data
State = "FindB2"
End If
Select Case itm.tagname
Case "DIV"
colCount = 4 'start each row in column D
RowCount = RowCount + 1
Case "SPAN"
Cells(RowCount, colCount) = itm.innertext
colCount = colCount + 1
End Select
End Select
Next itm
IE.Quit
End Sub
Sub Dump(document)
With Sheets("dump")
.Cells.ClearContents
RowCount = 1
For Each itm In document.all
.Range("A" & RowCount) = itm.tagname
.Range("B" & RowCount) = itm.className
.Range("C" & RowCount) = itm.ID
.Range("D" & RowCount) = Left(itm.innertext, 1024)
RowCount = RowCount + 1
Next itm
End With
End Sub