Pradeep770
New Member
Hi,
I want to login to a website and click on a link, i have a code to login to a site but i am not able to click on a link, i want this code to be checked and please help me to get this solved.below is the code i tried it works perfectly until clicking on a login button later it stops.
I want to login to a website and click on a link, i have a code to login to a site but i am not able to click on a link, i want this code to be checked and please help me to get this solved.below is the code i tried it works perfectly until clicking on a login button later it stops.
Code:
'''
Dim HTMLDoc As HTMLDocument
Dim oBrowser As InternetExplorer
Sub Login_2_Website()
Dim oHTML_Element As IHTMLElement
Dim sURL As String
On Error GoTo Err_Clear
sURL = "http://www.volkswagenlabs.co.in/volkswagenform/vw_reports/login.aspx"
Set oBrowser = New InternetExplorer
oBrowser.Silent = True
oBrowser.timeout = 60
oBrowser.navigate sURL
oBrowser.Visible = True
Do
' Wait till the Browser is loaded
Loop Until oBrowser.readyState = READYSTATE_COMPLETE
Set HTMLDoc = oBrowser.document
HTMLDoc.all.UserName.Value = "admin"
HTMLDoc.all.Password.Value = "db@vw"
For Each oHTML_Element In HTMLDoc.getElementsByTagName("input")
If oHTML_Element.Type = "submit" 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
'''
Last edited by a moderator: