Hello guys,
I am trying to extract the family names of plants from http://www.theplantlist.org/ and put them in B column corresponding to the respective names of plants on column A. I tried writing VBA code but ended up getting "Run-time error- 91".
Note: I mistakenly wrote "Run-time error 19" as this Thread title!!
Would you please look up my code and correct if not write up so that desired result can be achieved?
Sub Extractfamilyname()
Dim ie As New InternetExplorer
Dim Genus As String
Dim doc As MSHTML.HTMLDocument
Genus = Sheet1.Range("A2").Value
ie.Visible = True
ie.navigate "http://www.theplantlist.org/tpl/search?q=" & Genus
Do
DoEvents
Loop Until ie.readyState = READYSTATE_COMPLETE
With doc
Set output = .getElementsByClassName("class").Item(0).innerText
End With
Sheet1.Range("B2").Value = output
ie.Quit
End Sub
Data format (problem):
column A . . . . . . . Column B
Musa
Triticum
Chrysanthemum
Jatropha
Oryza
Data format (expected solution):
column A . . . . . . . Column B
Musa . . . . . . . . . Musaceae
Triticum . . . . . . . Poaceae
Chrysanthemum . . Compositae
Jatropha . . . . . . . Euphorbiaceae
Oryza . . . . . . . . . Poaceae
Retrieving Data from internet.xlsm
Bookmarks