what I'm trying to achieve from Excel VBA is:
- open a webpage and search for a specific form and input
- fill the input and submit the form through a link tag
- search the new webpage generated by that submitted form.
Tasks 1 is done, and I'm trying to figure out why i'm getting an error 'ACCESS DENIED -2147024891 error' when the link is clicked.
My code so far for 1 and 2 :
Dim http As New XMLHTTP60
Dim html As New HTMLDocument
Dim cp12Element As HTMLInputTextElement
Dim formElement As HTMLFormElement
Dim response As String
With http
.Open "GET", "http://me.intra-dmu-13.dv.mes.reseau.intra/conformite/SoutienConformite/AcafWeb/AdrsGDI.asp?CP12=" & cp12, False
.send
If .Status <> 200 Then
MsgBox "Error, the file number entered is invalid.", vbCritical
Exit Sub
End If
response = StrConv(.responseBody, vbUnicode)
End With
html.body.innerHTML = response
html.getElementsByName("CP12").Item(0).Value = "AAAA010101A1"
html.getElementsByClassName("lien").Item(0).Click <--- ERROR
' html.getElementsByName("fAdrs").Item(0).submit <--- generate the same error
The form's name is 'fAdrs' and there is only 1 input 'CP12'. The form's method is POST.
The HTML code of the page :
The function DoSubmit just a call a validation function and then submit the form.
Any help would be gladly appreciated.
