Inputting info in webform from excel vba

B

BigPig

Hello All,

Problem: I can't input data through excel userform in one page of a website
(a ssn field). But I am able to put in my uname and pw to get into that site.

Explanation: Through an excel userform, I access a website that asks for
username and password, submit buttons, and moves to another webpage that has
another field that I can't seem to enter data in (from excel). I'm hoping
that it's something simple that I'm missing.

Referenced Code:
Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")
With ie
ie.Visible = True

..Navigate "https:blahblahblah/login.jsp"

Do While ie.Busy And Not ie.ReadyState = 4:
Application.Wait (Now + TimeValue("0:00:02"))
DoEvents
Loop

ie.Document.all("username").Value = "myusername"
ie.Document.all("password").Value = "mypw"

ie.Document.forms(0).submit

Do While ie.Busy And Not ie.ReadyState = 4:
Application.Wait (Now + TimeValue("0:00:02"))
DoEvents
Loop

..Navigate "http:tothenextwebpagebecauseicantfigureouthowtofindclicklink"
Do While ie.Busy And Not ie.ReadyState = 4:
Application.Wait (Now + TimeValue("0:00:02"))
DoEvents
Loop

ie.Document.forms("ZZForm").ssn.Value = "someonesssn"

Other info:
After viewing the source code it appears that the 'Form' name of this part
of a webpage is labeled "ZZForm". In that 'form' is a textbox that appears to
be labeled "ssn". I am not familiar with html or web-based languages. I keep
seeing in the 'source code' "ZZForm.ssn.value".

I am trying to input a person's ssn in order to view update edit etc...
their records.
The error I keep getting is "Object variable or with variable not set". I
can't seem to figure out where I am making a mistake. I believe it may be
with the way I am labeling (or mislabeling) objects. Or something I need to
set.

I have been able to access/update/edit all of this using sendkeys, but as
you know it's not dependable.

Thanks for your help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top