Click here to Skip to main content
15,881,715 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Assume this web link:
http://worldwide.espacenet.com/publicationDetails/biblio?DB=EPODOC&II=0&ND=3&adjacent=true&locale=en_EP&FT=D&date=19950620&CC=US&NR=5425515A&KC=A

I need to fetch data from many such links. I have almost completed writing the code but facing a small problem. If you open the web page, there is some data (patent numbers) corresponding to "Also published as:" title. I need to copy those patent numbers and paste it in excel. The problem is, sometimes the title "Also published as:" does not exist and in that case I need to keep the cell blank. How do I place a check that whether the "Also published as:" exists in the web page or not?

The code:

num3 = ActiveSheet.UsedRange.Rows.Count
For num2 = 2 To num3
ie1.Visible = True
ie1.navigate Range("T" & num2).Value
Do
DoEvents
Loop Until ie1.readyState = READYSTATE_COMPLETE
Set doc1 = ie1.document
dd1 = Trim(doc1.getElementsByTagName("th")(8).innerText)
If InStr(dd1, "published") Then
sdd1 = Trim(doc1.getElementsByTagName("td")(9).innerText)
Range("B" & num2).Value = sdd1
Else
Range("B" & num2).Value = ""
End If
Next num2
ie1.Quit


Column T contains the web links to be accessed 9th tag contains the text "Also published as:" 10th tag contains the data (patent numbers) to be fetched

Please help
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900