I am trying to scrape data from a password protected site to which I have access. My VBA currently gets me into the main page, navigates to a page I wish to download, loads the table, and then I'm stuck.
I need to direct the code to submit/hit download to excel/enter the form etc. I have tried numerous combinations without success. The code I am using is:
Dim a As String, URL As String
Set ie = CreateObject("InternetExplorer.Application")
URL = "Horse Racing Database Solutions"
With ie
.Visible = True
.Navigate URL
Do Until .ReadyState = 4
DoEvents
Loop
.Document.all.Item("Login").Value = "************"
.Document.all.Item("Password").Value = "******************"
.Document.forms(4).submit
End With
URL = "Daily Jockeys Report"
ie.Navigate URL
'Stuck with next line
Set HTMLButton = ie.Document.getElementsByTagName("Download to Excel")
' ie.Document.Item("downloadbutton") = Click
HTMLButton.Click
Which gets me to where I need to download the table. Below is extracted from the page concerned.
<td title="Download the Jockey report">
<form action="dailyjockeysexcel.php" method="post"><input name="user" type="hiddenvalue="28321">
<input name="totem" type="hidden" value="8bb3fe04b9ce63f2c86bf2ee7c30a3313c66dca2">
**<input title="Download to Excel" class="downloadbutton" type="submit" value="XLS"</form</td>**
I need to direct the code to submit/hit download to excel/enter the form etc. I have tried numerous combinations without success. The code I am using is:
Dim a As String, URL As String
Set ie = CreateObject("InternetExplorer.Application")
URL = "Horse Racing Database Solutions"
With ie
.Visible = True
.Navigate URL
Do Until .ReadyState = 4
DoEvents
Loop
.Document.all.Item("Login").Value = "************"
.Document.all.Item("Password").Value = "******************"
.Document.forms(4).submit
End With
URL = "Daily Jockeys Report"
ie.Navigate URL
'Stuck with next line
Set HTMLButton = ie.Document.getElementsByTagName("Download to Excel")
' ie.Document.Item("downloadbutton") = Click
HTMLButton.Click
Which gets me to where I need to download the table. Below is extracted from the page concerned.
<td title="Download the Jockey report">
<form action="dailyjockeysexcel.php" method="post"><input name="user" type="hiddenvalue="28321">
<input name="totem" type="hidden" value="8bb3fe04b9ce63f2c86bf2ee7c30a3313c66dca2">
**<input title="Download to Excel" class="downloadbutton" type="submit" value="XLS"</form</td>**