Web Forms manipulated by Visual Basic

One of the examples I came across while going through www.ozgrid.com is as follows. Maybe this will help you understanding how vb works while filling webforms. If you comeacross something interesting please keep me posted.  -selvavinaygam

Sub Going_Postal()
Dim ie As Object
Set ie = CreateObject(“InternetExplorer.Application”)
On Error GoTo errHandler

With ie
    .navigate “http://www.canadapost.ca/personal/tools/pcl/bin/quick-e.asp
    .Visible = True
   

    Do While .busy: DoEvents: Loop
    Do While .ReadyState <> 4: DoEvents: Loop
    With .document.Forms(1)
        ‘Stree Number
        .street_number.Value = “10132”
        ‘Stree Name
        .street_name.Value = “Imperial Street”
        ‘City
        .city.Value = “Chilliwack”
        ‘AB = Alberta, BC = British Columbia, MB = Manitoba, NB = New Brunswick, _
            NL = Newfoundland and Labrador, NS = Nova Scotia, NT = Northwest Territories, _
            NU = Nunavut, ON = Ontario, PE = Prince Edward Island, QC = Quebec, _
            SK = Saskatchewan, YT = Yukon
        .prov.Value = “BC”
        .submit
    End With
    Do While Not CBool(InStrB(1, .document.URL, _
        “cp_search_response-e.asp”))
        DoEvents
    Loop
    Do While .busy: DoEvents: Loop
    Do While .ReadyState <> 4: DoEvents: Loop
    MsgBox .document.all.tags(“table”).Item(11).Rows(1).Cells(7).innerText
End With

errHandler:
ie.Quit: Set ie = Nothing
End Sub

Advertisements

1 Comment »

  1. […] Web Forms manipulated by Visual Basic […]

RSS feed for comments on this post · TrackBack URI

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: