|
楼主 |
发表于 2013-4-14 18:57
|
显示全部楼层
html2013 发表于 2013-4-11 20:04
Sub nature_museum查询()
On Error Resume Next
With CreateObject("internetexplorer.applica ...
麻烦老师帮我看看,我自己加了个循环,但不知怎么执行不了?
Sub nature_museum查询()
On Error Resume Next
With CreateObject("internetexplorer.application")
for m = 1 to 200000
.Visible = False
.Navigate "http://www.nature-museum.net/Spdb/spsearch.aspx"
While .ReadyState <> 4 Or .busy
DoEvents
Wend
.document.getElementById("txtSearchName").Value = Cells(1, m)
.document.getElementById("QueryCmd").Click
Set r = .document.getElementById("QueryResult").All.tags("table")
t1 = Timer
ss = ""
Do Until Timer > t1 + 1000
ss = r(0).Rows(0).Cells(1).innerText
If ss <> "" Then GoTo 1
DoEvents
ss = ""
Loop
next
1:
For i = 0 To r.Length - 1
Set r1 = r(i).Rows
temp = Split(r1(0).Cells(1).innerText, vbCrLf)
Range(Cells(i + 1, 1), Cells(i + 1, UBound(temp))) = temp
If Left(Cells(i + 1, "C"), 2) = "别名" Then
Range("C" & i + 1).Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
End If
Next i
Set r = Nothing
.Quit
End With
End Sub
|
|