Hi,
I have created a web query to get a data from the web to my excel sheet. There are 2 data tables on this page.
The web query is as follows -
WEB
1
http://www.dtcc.com/products/derivserv/data_table_iii.php?id=3.22
Selection=dataTable
Formatting=None
PreFormattedTextToColumns=True
ConsecutiveDelimitersAsOne=True
SingleBlockTextImport=False
DisableDateRecognition=False
DisableRedirections=False
However when the user tried to refresh the data for the first time from his machine he is redirected to a consent page. This page have "I Agree"and "Decline" button. -
http://www.dtcc.com/products/consent.php?id=tiwd/products/derivserv/data_table_iii.php?id=3.22
I tried automating the clicking of I Agree button through VBA with the help of following code -
Dim HTMLDoc As HTMLDocument
Dim oBrowser As InternetExplorer
Sub Consent_To_DTCC()
Dim oHTML_Element As IHTMLElement
Dim sURL As String
On Error GoTo Err_Clear
sURL = "http://www.dtcc.com/products/consent.php?id=tiwd/products/derivserv/data_table_iii.php"
Set oBrowser = New InternetExplorer
oBrowser.Silent = True
oBrowser.navigate sURL
oBrowser.Visible = False
Do
' Wait till the Browser is loaded
Loop Until oBrowser.readyState = READYSTATE_COMPLETE
Set HTMLDoc = oBrowser.document
For Each oHTML_Element In HTMLDoc.getElementsByTagName("input")
If oHTML_Element.Type = "submit" Then If oHTML_Element.getAttribute("value") = "I Agree" Then oHTML_Element.Click: Exit For
Next
' oBrowser.Refresh ' Refresh If Needed
Err_Clear:
If Err <> 0 Then
Debug.Assert Err = 0
Err.Clear
Resume Next
End If
End Sub
However the automation is still throwing a Runtime error 1004 sating that web query did not return any data when it is run for the first time on user machine. After the user manually go and click on the I accept button on the consent page, the automation works fine.
Can you please advise how do it i automate the "I agree" consent on any php page.
Thanks
Kbafna
I have created a web query to get a data from the web to my excel sheet. There are 2 data tables on this page.
The web query is as follows -
WEB
1
http://www.dtcc.com/products/derivserv/data_table_iii.php?id=3.22
Selection=dataTable
Formatting=None
PreFormattedTextToColumns=True
ConsecutiveDelimitersAsOne=True
SingleBlockTextImport=False
DisableDateRecognition=False
DisableRedirections=False
However when the user tried to refresh the data for the first time from his machine he is redirected to a consent page. This page have "I Agree"and "Decline" button. -
http://www.dtcc.com/products/consent.php?id=tiwd/products/derivserv/data_table_iii.php?id=3.22
I tried automating the clicking of I Agree button through VBA with the help of following code -
Dim HTMLDoc As HTMLDocument
Dim oBrowser As InternetExplorer
Sub Consent_To_DTCC()
Dim oHTML_Element As IHTMLElement
Dim sURL As String
On Error GoTo Err_Clear
sURL = "http://www.dtcc.com/products/consent.php?id=tiwd/products/derivserv/data_table_iii.php"
Set oBrowser = New InternetExplorer
oBrowser.Silent = True
oBrowser.navigate sURL
oBrowser.Visible = False
Do
' Wait till the Browser is loaded
Loop Until oBrowser.readyState = READYSTATE_COMPLETE
Set HTMLDoc = oBrowser.document
For Each oHTML_Element In HTMLDoc.getElementsByTagName("input")
If oHTML_Element.Type = "submit" Then If oHTML_Element.getAttribute("value") = "I Agree" Then oHTML_Element.Click: Exit For
Next
' oBrowser.Refresh ' Refresh If Needed
Err_Clear:
If Err <> 0 Then
Debug.Assert Err = 0
Err.Clear
Resume Next
End If
End Sub
However the automation is still throwing a Runtime error 1004 sating that web query did not return any data when it is run for the first time on user machine. After the user manually go and click on the I accept button on the consent page, the automation works fine.
Can you please advise how do it i automate the "I agree" consent on any php page.
Thanks
Kbafna