ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Inputting info in webform from excel vba (https://www.excelbanter.com/excel-programming/385358-inputting-info-webform-excel-vba.html)

BigPig

Inputting info in webform from excel vba
 
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:tothenextwebpagebecauseicantfigureouthowtofi ndclicklink"
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.



All times are GMT +1. The time now is 05:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com