• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User


  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to click on a link after loging in to a website


New Member

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.

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

' 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

' oBrowser.Refresh ' Refresh If Needed
If Err <> 0 Then
'Debug.Assert Err = 0
Resume Next
End If

End Sub
Last edited by a moderator: