VBA to copy website data by putting details one by one - excel

I have this website and i have been trying to create an function which collects ID Number from Col"A" and its Date of initiation in Col"B".
then adds the Sum of two boxes into 3rd one like below image.
after that it will go for the result it will be like
If the individual gets first dose then insert in Col"C" "1st Dose Done" If the individual gets second dose then insert in Col"D" "second dose done" if the individual has not taken both or single dose result will be empty.
then go for next until Col"A" used range. I have tried to create function but could not, Your help will be appreciated in this regards.
Option Explicit
Sub Newfunction()
Const Url$ = ""
Dim IdNumber As String, openDate As Date, LogData As Worksheet
Set LogData = ThisWorkbook.Worksheets("Sheet1")
IdNumber = LogData.Cells(2, "A").Value
openDate = LogData.Cells(2, "B").Value
Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")
With ie
.navigate Url
ieBusy ie
.Visible = True
Dim IDdata As Object, puttdate As Object, submitbut As String
Set IDdata = .document.getElementsByName("checkEligibilityForm:cnic")(0)
Set puttdate = .document.getElementsByName("checkEligibilityForm:issueDate_input")(0)
Set submitbut = .document.getElementsByClassName("submit__generated")(0).innerText
IDdata.Value = IdNumber
puttdate.Value = Format(openDate, "dd/mm/yyyy")
submitbut.Value = .document.getElementsByClassName("submit__input")(0)
Debug.Print .document.getElementsByClassName("submit__input")(0)
End With
End Sub
Sub ieBusy(ie As Object)
Do While ie.Busy Or ie.readyState < 4
DoEvents
Loop
End Sub

Try this code below - This should do the following:
Enter the CNIC
Enter the date
Answer the Captcha question
Click the button and the page should load.
As I can't proceed to the result page, I can't guarantee that it will produce the result page so please test it out with a proper data to see if it works. I have also tried to explain what each block of codes is doing in the comment.
Option Explicit
Sub Newfunction()
Const Url As String = "https://nims.nadra.gov.pk/nims/certificate"
Dim LogData As Worksheet
Set LogData = ThisWorkbook.Worksheets("Sheet1")
Dim IdNumber As String
Dim openDate As Date
IdNumber = LogData.Cells(2, "A").Value
openDate = LogData.Cells(2, "B").Value
Set LogData = Nothing
Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")
With ie
.navigate Url
Do While .Busy Or .readyState <> 4
DoEvents
Loop
.Visible = True
Dim ieDoc As Object
Set ieDoc = .Document
End With
'Enter the CNIC
Dim IDdata As Object
Set IDdata = ieDoc.getElementById("checkEligibilityForm:cnic")
If Not IDdata Is Nothing Then IDdata.Value = IdNumber
Set IDdata = Nothing
'Enter Date
Dim puttdate As Object
Set puttdate = ieDoc.getElementById("checkEligibilityForm:issueDate_input")
If Not puttdate Is Nothing Then puttdate.Value = Format(openDate, "dd-mm-yyyy")
Set puttdate = Nothing
'Answering the captcha question
'Split the innerText to string array to determine the equation
Dim captchaQns As Object
Set captchaQns = ieDoc.getElementsByClassName("submit__generated")(0)
If Not captchaQns Is Nothing Then
Dim mathEq() As String
mathEq = Split(captchaQns.innerText, " ")
Set captchaQns = Nothing
'mathEq(0) = first number
'mathEq(1) = math operator
'mathEq(2) = second number
If IsNumeric(mathEq(0)) Then
Dim firstNum As Long
firstNum = CLng(mathEq(0))
If IsNumeric(mathEq(2)) Then
Dim secondNum As Long
secondNum = CLng(mathEq(2))
'Select Case statement used here in case you encounter other form of math question (e.g. - X /), expand cases to cater for other scenario
Dim mathAnswer As Long
Select Case mathEq(1)
Case "+": mathAnswer = firstNum + secondNum
End Select
End If
End If
If mathAnswer <> 0 Then
'Enter the answer to the box
Dim captchaAns As Object
Set captchaAns = ieDoc.getElementsByClassName("submit__input")(0)
If Not captchaAns Is Nothing Then captchaAns.Value = mathAnswer
Set captchaAns = Nothing
'Get the submit button element, remove "disabled" attribute to allow clicking
Dim submitBtn As Object
Set submitBtn = ieDoc.getElementsByName("checkEligibilityForm:j_idt79")(0)
submitBtn.removeAttribute "disabled"
submitBtn.Click
Set submitBtn = Nothing
End If
End If
End Sub

Related

Copy Data from Web page and paste into Excel

I have been trying to scrape the web data using EXCEL VBA. Below code paste the date from excel to wen then initiated the submit button to go to the result page. which looks like this:
I want to copy and paste the first and the second line into excel like this:
if any individual gets first dose then put details of first dose, and return empty for the second dose if its empty. If both dose are not available then return empty for both.
I am not able to develop this last thing and struggling since couple of hours to achieve this (copy data and paste into excel)
it would required a ID number and date to submit for the result that i can provide in comments. I have been using following code to accomplish this your help will be much appreciated.
Option Explicit
Sub Newfunction()
Const Url As String = ""
Dim LogData As Worksheet
Set LogData = ThisWorkbook.Worksheets("Sheet1")
Dim IdNumber As String
Dim openDate As Date
IdNumber = LogData.Cells(3, "A").Value
openDate = LogData.Cells(3, "B").Value
Set LogData = Nothing
Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")
With ie
.Navigate Url
Do While .Busy Or .ReadyState <> 4
DoEvents
Loop
.Visible = True
Dim ieDoc As Object
Set ieDoc = .Document
End With
'Enter the CNIC
Dim IDdata As Object
Set IDdata = ieDoc.getElementById("checkEligibilityForm:cnic")
If Not IDdata Is Nothing Then IDdata.Value = IdNumber
Set IDdata = Nothing
'Enter Date
Dim puttdate As Object
Set puttdate = ieDoc.getElementById("checkEligibilityForm:issueDate_input")
If Not puttdate Is Nothing Then puttdate.Value = Format(openDate, "dd-mm-yyyy")
Set puttdate = Nothing
'Answering the captcha question
'Split the innerText to string array to determine the equation
Dim captchaQns As Object
Set captchaQns = ieDoc.getElementsByClassName("submit__generated")(0)
If Not captchaQns Is Nothing Then
Dim mathEq() As String
mathEq = Split(captchaQns.innerText, " ")
Set captchaQns = Nothing
'mathEq(0) = first number
'mathEq(1) = math operator
'mathEq(2) = second number
If IsNumeric(mathEq(0)) Then
Dim firstNum As Long
firstNum = CLng(mathEq(0))
If IsNumeric(mathEq(2)) Then
Dim secondNum As Long
secondNum = CLng(mathEq(2))
'Select Case statement used here in case you encounter other form of math question (e.g. - X /), expand cases to cater for other scenario
Dim mathAnswer As Long
Select Case mathEq(1)
Case "+": mathAnswer = firstNum + secondNum
End Select
End If
End If
If mathAnswer <> 0 Then
'Enter the answer to the box
Dim captchaAns As Object
Set captchaAns = ieDoc.getElementsByClassName("submit__input")(0)
If Not captchaAns Is Nothing Then captchaAns.Value = mathAnswer
Set captchaAns = Nothing
'Get the submit button element, remove "disabled" attribute to allow clicking
Dim submitBtn As Object
Set submitBtn = ieDoc.getElementsByName("checkEligibilityForm:j_idt79")(0)
submitBtn.removeAttribute "disabled"
submitBtn.Click
Set submitBtn = Nothing
End If
End If
Dim tbls, tbl, trs, tr, tds, td, r, c
Set tbl = ie.Document.getElementsByTagName("table")(0)
Set trs = tbl.getElementsByTagName("tr")
For r = 0 To trs.Length - 1
Set tds = trs(r).getElementsByTagName("tr")
'if no <td> then look for <th>
If tds.Length = 0 Then Set tds = trs(r).getElementsByTagName("td")
For c = 0 To tds.Length - 1
ActiveSheet.Range("C4").Offset(r, c).Value = tds(c).innerText
Next c
Next r
End Sub
Try this:
It will enter the data into Range("C4:F4") for first dose and Range("G4:J4") for second dose.
Sub Newfunction()
Const Url As String = "https://nims.nadra.gov.pk/nims/certificate"
Dim LogData As Worksheet
Set LogData = ThisWorkbook.Worksheets("Sheet1")
Dim lastRow As Long
lastRow = LogData.Range("A" & Rows.Count).End(xlUp).Row
Dim currentRow As Long
For currentRow = 3 to lastRow
Dim IdNumber As String
Dim openDate As Date
IdNumber = LogData.Cells(currentRow, 1).Value
openDate = LogData.Cells(currentRow, 2).Value
Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")
With ie
.navigate Url
Do While .Busy Or .readyState <> 4
DoEvents
Loop
.Visible = True
Dim ieDoc As Object
Set ieDoc = .document
End With
'Enter the CNIC
Dim IDdata As Object
Set IDdata = ieDoc.getElementById("checkEligibilityForm:cnic")
If Not IDdata Is Nothing Then IDdata.Value = IdNumber
Set IDdata = Nothing
'Enter Date
Dim puttdate As Object
Set puttdate = ieDoc.getElementById("checkEligibilityForm:issueDate_input")
If Not puttdate Is Nothing Then puttdate.Value = Format(openDate, "dd-mm-yyyy")
Set puttdate = Nothing
'Answering the captcha question
'Split the innerText to string array to determine the equation
Dim captchaQns As Object
Set captchaQns = ieDoc.getElementsByClassName("submit__generated")(0)
If Not captchaQns Is Nothing Then
Dim mathEq() As String
mathEq = Split(captchaQns.innerText, " ")
Set captchaQns = Nothing
'mathEq(0) = first number
'mathEq(1) = math operator
'mathEq(2) = second number
If IsNumeric(mathEq(0)) Then
Dim firstNum As Long
firstNum = CLng(mathEq(0))
If IsNumeric(mathEq(2)) Then
Dim secondNum As Long
secondNum = CLng(mathEq(2))
'Select Case statement used here in case you encounter other form of math question (e.g. - X /), expand cases to cater for other scenario
Dim mathAnswer As Long
Select Case mathEq(1)
Case "+": mathAnswer = firstNum + secondNum
End Select
End If
End If
Erase mathEq
If mathAnswer <> 0 Then
'Enter the answer to the box
Dim captchaAns As Object
Set captchaAns = ieDoc.getElementsByClassName("submit__input")(0)
If Not captchaAns Is Nothing Then captchaAns.Value = mathAnswer
Set captchaAns = Nothing
'Get the submit button element, remove "disabled" attribute to allow clicking
Dim submitBtn As Object
Set submitBtn = ieDoc.getElementsByName("checkEligibilityForm:j_idt79")(0)
submitBtn.removeAttribute "disabled"
submitBtn.Click
Set submitBtn = Nothing
End If
End If
With ie
Do While .Busy Or .readyState <> 4
DoEvents
Loop
Set ieDoc = .document
End With
Dim resultTbl As Object
Set resultTbl = ieDoc.getElementsByTagName("table")
If resultTbl.Length <> 0 Then
Dim resultRows As Object
Set resultRows = resultTbl(0).getElementsByTagName("tr")
If resultRows.Length > 1 Then
'Get the 2nd row (1st row is header so ignore)
Dim firstDose As Object
Set firstDose = resultRows(1).getElementsByTagName("td")
LogData.Cells(currentRow, 3).Value = firstDose(0).innerText
LogData.Cells(currentRow, 4).Value = firstDose(1).innerText
LogData.Cells(currentRow, 5).Value = firstDose(2).innerText
LogData.Cells(currentRow, 6).Value = firstDose(3).innerText
Set firstDose = Nothing
'If there are totals of 3 TR elements then there are 2nd dose
If resultRows.Length = 3 Then
Dim secondDose As Object
Set secondDose = resultRows(2).getElementsByTagName("td")
LogData.Cells(currentRow, 7).Value = secondDose(0).innerText
LogData.Cells(currentRow, 8).Value = secondDose(1).innerText
LogData.Cells(currentRow, 9).Value = secondDose(2).innerText
LogData.Cells(currentRow, 10).Value = secondDose(3).innerText
Set secondDose = Nothing
End If
'Else
'Do something here if there is only a header row i.e. no dose (assumption)
End If
Set resultRows = Nothing
End If
Set resultTbl = Nothing
Set ieDoc = Nothing
ie.Quit 'Remove if you don't want to close IE
Set ie = Nothing 'Remove if you don't want to close IE
Next currentRow
Set LogData = Nothing
End Sub

Get URL of the image that is the first result in google images

I have multiple keywords in an excel file, I am looking for a way to get the image URL of the first google image result on another cell in this excel file,
For Example
if my cell A1 contains "tomato"
I want cell A2 to display "https://seeds-gallery.com/4963-large_default/novosadski-jabucar-tomato-450-seeds.jpg" which is the image URL of the first result that shows up on Google Images
Can someone please help me out
You could do that in VBA using something like the following;
Public Sub InsertPicturesFromWeb()
Dim IE As InternetExplorer
Dim HTMLdoc As HTMLDocument
Dim imgElements As IHTMLElementCollection
Dim imgElement As HTMLImg
Dim aElement As HTMLAnchorElement
Dim N As Integer, I As Integer
Dim Url As String, Url2 As String
Dim LastRow As Long
Dim M, sImageSearchString
LastRow = Range("A" & Rows.Count).End(xlUp).Row
For I = 1 To LastRow
Url = "https://www.google.co.in/search?q=" & Cells(I, 1) & "&source=lnms&tbm=isch&sa=X&rnd=1"
Set IE = New InternetExplorer
With IE
.Visible = False
.Navigate Url
Do Until .readyState = 4: DoEvents: Loop
Set HTMLdoc = .document
Set imgElements = HTMLdoc.getElementsByTagName("IMG")
N = 1
For Each imgElement In imgElements
If InStr(imgElement.src, sImageSearchString) Then
If imgElement.ParentNode.nodeName = "A" Then
Set aElement = imgElement.ParentNode
Url2 = imgElement.src
N = N + 1
End If
End If
Next
Call GetShapeFromWeb(Url2, Cells(I, 2))
IE.Quit
Set IE = Nothing
End With
Next I
End Sub
Sub GetShapeFromWeb(strShpUrl As String, rngTarget As Range)
With rngTarget.Parent
.Pictures.Insert strShpUrl
.Shapes(.Shapes.Count).Left = rngTarget.Left
.Shapes(.Shapes.Count).Top = rngTarget.Top
End With
End Sub

Scrape CDC vaccination data using VBA

I am trying to scrape the vaccination data from the below CDC website:
https://covid.cdc.gov/covid-data-tracker/#vaccinations
I have tried querySelectorAll but no luck. Can anyone help take a look? Much appreciated!
Sub useClassnames()
Dim appIE As Object
Set appIE = CreateObject("internetexplorer.application")
With appIE
.navigate "https://covid.cdc.gov/covid-data-tracker/#vaccinations"
.Visible = False
End With
Do While appIE.Busy
DoEvents
Loop
Set allRowOfData = appIE.document.getElementById("maincontent")
Debug.Print allRowOfData.innerHTML
'Set element = appIE.document.querySelectorAll(".container mt-5")
'For Each elements In element
' Debug.Print elements
'Next elements
'For Each element In allRowOfData
'Debug.Print element
'Next element
End Sub
Here you have, just change your worksheet name or number :)
Option Explicit
Const updatedCol = 1
Const dosesDistributedColVal = 2
Const peopleInicVaccColVal = 3
Sub useClassnames()
'declare worksheet variable and set headers
Dim targetWsh As Worksheet: Set targetWsh = ThisWorkbook.Sheets(1)
targetWsh.Cells(1, 1).Value = "Last Update"
targetWsh.Cells(1, 2).Value = "Doses Distributed"
targetWsh.Cells(1, 3).Value = "People Initiating Vaccination"
Dim lstRegisterRow As Long: lstRegisterRow = targetWsh.Range("A" & targetWsh.Rows.Count).End(xlUp).Row + 1
'open IE and navigate to site
Dim appIE As InternetExplorer: Set appIE = New InternetExplorer
appIE.navigate "https://covid.cdc.gov/covid-data-tracker/#vaccinations"
appIE.Visible = False
While appIE.Busy = True Or appIE.readyState < 4: DoEvents: Wend
Dim oHtmlDoc As HTMLDocument: Set oHtmlDoc = appIE.document
Dim oHtmlElementColl As IHTMLElementCollection
'Get and write last update date
Application.Wait (Now + TimeValue("0:00:02")) 'wait 2 secs to avoid error, if recieve error, add seconds as needed
Set oHtmlElementColl = oHtmlDoc.getElementsByTagName("small")
targetWsh.Cells(lstRegisterRow, updatedCol) = oHtmlElementColl(0).innerHTML
'Get and write Doses Distributed and People Initiating Vaccination
Set oHtmlElementColl = oHtmlDoc.GetElementsByClassName("card-number")
targetWsh.Cells(lstRegisterRow, dosesDistributedColVal) = oHtmlElementColl(0).innerText
targetWsh.Cells(lstRegisterRow, peopleInicVaccColVal) = oHtmlElementColl(1).innerText
appIE.Quit
End Sub

How to upload values to a website and select a button using Excel VBA

I am trying to automate the sending of SMSes from a company website but I do not know how to upload the message, the cellphone number and select the button to send the message.
Sub smssend()
Dim appIE As Object
Dim e As Object
Dim wb As Workbook
Dim ws As Worksheet
Dim cellno As String
Dim mess As String
Dim strPattern As String: strPattern = "^((?:\+27|0[0-9]{9}"
Dim regEx As New RegExp
Dim linecount As Long
linecount = 2
Set wb = Application.Workbooks("SMSmacro")
Set ws = wb.Worksheets("Sheet1")
Set appIE = CreateObject("internetexplorer.application")
With appIE
.navigate "http://cadde.abgza.co.za/SMS/CreateSMS/CreateSms"
Do While appIE.busy
DoEvents
Application.Wait (Now + TimeValue("0:00:03"))
Loop
.Visible = True
End With
Do While appIE.busy
DoEvents
Application.Wait (Now + TimeValue("0:00:03"))
Loop
Do While ws.Cells(linecount, 1) <> ""
cellno = ws.Cells(linecount, 1)
mess = ws.Cells(linecount, 2)
a = Len(mess)
If Len(mess) > 160 Then
ws.Cells(linecount, 4).Value = "Message Too Long"
GoTo nxt
End If
With regEx
If regEx.Test(cellno) Then
With appIE
Set e = appIE.document.getElementById("cellNumber")
e = cellno
End With
Else
ws.Cells(linecount, 3).Value = "Incorrect Cell Number"
End If
End With
nxt:
linecount = linecount + 1
Loop
End Sub
I've rewritten your code. Never use GoTo, except for error handling.
The three variables nodeCellNo, nodeMess and nodeSubBut are not mandatory. I have introduced them to make the code more comprehensible for you. Without variables you can access a node directly this way:
appIE.document.getElementById("cellNumber").Value = cellNo
I can't tell from your HTML code whether the change event of the textarea tag needs to be triggered to recognize the text of the message.
Please read the comments in the code carefully:
Sub SendSMS()
'If you have constant values use constants in your code
Const url As String = "http://cadde.abgza.co.za/SMS/CreateSMS/CreateSms"
Const strPattern As String = "^((?:\+27|0[0-9]{9}"
'If you use late binding, no Excel reference is required
'Advantage: The code runs immediately on every computer
'Disadvantage: No IntelliSense is available during programming
Dim appIE As Object
Dim nodeCellNo As Object
Dim nodeMess As Object
Dim nodeSubBut As Object
Dim wb As Workbook
Dim ws As Worksheet
Dim cellNo As String
Dim mess As String
Dim regEx As Object 'Changed to late binding
Dim currentRow As Long
'Initialize variables
currentRow = 2
Set wb = Application.Workbooks("SMSmacro.xlsm") 'Full name needed
Set ws = wb.Worksheets("Sheet1")
Set regEx = CreateObject("VBScript.RegExp")
Set appIE = CreateObject("internetexplorer.application")
'Use the following line if you are in an intranet and
'the IE lost connection to the remote server
'Set appIE = GetObject("new:{D5E8041D-920F-45e9-B8FB-B1DEB82C6E5E}")
'Load page to IE
appIE.Visible = True
appIE.navigate url
Do While appIE.busy: DoEvents: Loop
'The following line is only needed if the web page loads dynamic
'content after IE has reported that it is no longer busy
'The length of the break can be adjusted to your needs
Application.Wait (Now + TimeValue("0:00:03"))
'If the page looks like the SMS sending page after sending,
'the loop can start here. If another page is loaded, one
'could navigate again within the loop to the SMS URL. For
'many SMS I would set the loop further up and restart IE
'for each SMS. Unfortunately, if you navigate a lot in one
'instance of IE, it becomes unstable.
Do While ws.Cells(currentRow, 1) <> ""
cellNo = ws.Cells(currentRow, 1).Value
mess = ws.Cells(currentRow, 2).Value
If Len(mess) > 160 Then
ws.Cells(currentRow, 4).Value = "Message Too Long"
Else
If regEx.Test(cellNo) Then
'Insert cellphone number to html form
Set nodeCellNo = appIE.document.getElementById("cellNumber")
nodeCellNo.Value = cellNo
'Insert message to html form
'The textarea tag has no value attribute
'You can set the text by innertext to set it
'between the opening and the closing tectarea tag
Set nodeMess = appIE.document.getElementById("typedMessage")
nodeMess.innertext = mess
'Click submit button
Set nodeSubBut = appIE.document.getElementById("btnSend")
nodeSubBut.Click
'Wait to send the SMS
Application.Wait (Now + TimeValue("0:00:03"))
Else
ws.Cells(currentRow, 3).Value = "Incorrect Cell Number"
End If
End If
'Next SMS
currentRow = currentRow + 1
Loop
End Sub

Importing/scraping an website into excel

I am trying to scrape some data from a database, and I have it pretty much set. I look in IE for a tab that has me logged in into the database, and paste the query link there through vba. But how do I extract the data that it returns from the IE tab and put that into an excel cell or array.
This is the code I have for opening my query:
Sub import()
Dim row As Integer
Dim strTargetFile As String
Dim wb As Workbook
Dim test As String
Dim ie As Object
Call Fill_Array_Cultivar
For row = 3 To 4
Sheets.Add.Name = Cultivar_Array(row, 1)
strTargetFile = "https://www3.wipo.int/pluto/user/jsp/select.jsp?fl=app_date%2Cden_info%2Cden_final&hl=false&json.nl=map&wt=json&type=upov&start=0&qi=3-nNCXQ6etEVv184O9nnd5yg%3D%3D&q=cc%3AIT%20AND%20latin_name%3A(zea%20mays)%20AND%20den_info%3A" & Trim(Cultivar_Array(row, 1)) & "&facet=false"
Set ie = GetIE("https://www3.wipo.int" & "*")
If Not ie Is Nothing Then
ie.navigate (strTargetFile)
Else
MsgBox "IE not found!"
End If
Next row
End Sub
And this is the appropriate function:
'Find an IE window with a matching (partial) URL
'Assumes no frames.
Function GetIE(sAddress As String) As Object
Dim objShell As Object, objShellWindows As Object, o As Object
Dim retVal As Object, sURL As String
Set retVal = Nothing
Set objShell = CreateObject("Shell.Application")
Set objShellWindows = objShell.Windows
'see if IE is already open
For Each o In objShellWindows
sURL = ""
On Error Resume Next
sURL = o.document.Location
On Error GoTo 0
If sURL <> "" Then
If sURL Like sAddress & "*" Then
Set retVal = o
Exit For
End If
End If
Next o
Set GetIE = retVal
End Function
What the website returns to me is a white page with a line of text. Here is an example:
{"response":{"start":0,"docs":[{"den_final":"Abacus","app_date":"1998-01-13T22:59:59Z"}],"numFound":1},"qi":"3-nNCXQ6etEVv184O9nnd5yg==","sv":"bswa2.wipo.int","lastUpdated":1436333633993}
PS. I also tried using the importxml function, it will import the website, but only an error page, as it does not recognize me as logged in.
I found the solution, which was fairly simple but hard to find.
I can just grab the ie.Document.body.innertext which is all the text I need.
See the code I updated below:
Sub import()
Dim row As Integer
Dim strTargetFile As String
Dim wb As Workbook
Dim test As String
Dim ie As Object
Dim pageText As String
Call Fill_Array_Cultivar
For row = 3 To 4
Sheets.Add.Name = Cultivar_Array(row, 1)
strTargetFile = "https://www3.wipo.int/pluto/user/jsp/select.jsp?fl=app_date%2Cden_info%2Cden_final&hl=false&json.nl=map&wt=json&type=upov&start=0&qi=3-nNCXQ6etEVv184O9nnd5yg%3D%3D&q=cc%3AIT%20AND%20latin_name%3A(zea%20mays)%20AND%20den_info%3A" & Trim(Cultivar_Array(row, 1)) & "&facet=false"
Set ie = GetIE("https://www3.wipo.int" & "*")
If Not ie Is Nothing Then
ie.navigate (strTargetFile)
Do Until ie.ReadyState = 4: DoEvents: Loop
pageText = ie.Document.body.innertext
ActiveSheet.Cells(1, 1) = pageText
pageText = Empty
Else
MsgBox "IE not found!"
End If
Next row
End Sub

Resources