• 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

    Hui...

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

Help with automating webform using IE

Ranjith kumar

New Member
Hi everyone,

I'm trying to automate filling a webform using Internet explorer but i'm not getting that, I get the following error : 'Object variable or with block variable not set'
This is the code I'm using
Code:
Public Sub testing()
Dim MyDoc As Object
Set IE = CreateObject("InternetExplorer.application")
IE.Visible = True
IE.navigate ("http://164.100.80.164/vow/Home.aspx")
Do Until IE.readyState = 4
DoEvents
Loop

Set MyDoc = IE.document
MyDoc.getElementById("ctl00_MainContent_lbcitizens").Click
Do Until IE.readyState = 4
DoEvents
Loop

Set MyDoc = IE.document
MyDoc.getElementById("ctl00_MainContent_txtownername").Value = "Ranjith"

End Sub

Please help me with this, thanks in advance.
 

Hi,

obvious error message : bad code conception !
IE.readyState works only to load initial webpage !

Could be replaced by IE.locationName equals to page's title
once fully loaded …

A noob way is to insert time delay in code (Wait) …

Follow the code using step by step mode (via F8 key)
to find out where error occurs.
 
Last edited:
Back
Top