|
bailanhong 发表于 2013-4-10 22:18
蓝天老师指导下!!!
Sub nature_museum查询()
On Error Resume Next
With CreateObject("internetexplorer.application")
.Visible = False
.Navigate "http://www.nature-museum.net/Spdb/spsearch.aspx"
While .ReadyState <> 4 Or .busy
DoEvents
Wend
.document.getElementById("txtSearchName").Value = "枫树"
.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
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 |
|