Handle WebForm via VB

 

Private Sub SomePages_Login()
Dim navURL, uName, uPass As String
Dim ie As Object

‘Change following couple of lines with you ID & Password
    uName = “myUsername”
    uPass = “myPassword”

‘This sets the url of the page, in this case
‘rediff login page
    navURL = “http://myUrl for form.open/

‘Create internetexplorer and provide url
    Set ie = CreateObject(“InternetExplorer.Application”)
    ie.navigate navURL

‘set visibility as true
    ie.Visible = True

‘wait until IE is done loading page.
    While ie.Busy
      DoEvents
    Wend

‘Enter userid and password in respective textboxes
    ie.document.forms(0).login.Value = uName
    ie.document.forms(0).passwd.Value = uPass

‘click submit button
    ie.document.forms(0).submit

‘wait until IE is done loading page.
    While ie.Busy
      DoEvents  ‘wait until IE is done loading page.
    Wend
Set ie = Nothing

End Sub

The other way to handle the form will be as follows

               ie.document.all(“login”).Value = uName
               ie.document.all(“passwd”).Value = uPass
   
I am not very sure if this works with all cases, i think I need to work on this bit more.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: