<dr***@umuc.edu> wrote in message
news:0T8yb.22007$yM6.14908@lakeread06...
I'm trying to create a vbscript so that I can autologin and
get my tasks done unattended. As part of my code, I'm trying
to click to get the vbscript to click the "Login" button but
I'm always getting that error mentioned below. The unusual
thing about it is that the login and password fields are
filled but the line of code where it's supposed to click the
login button returns an error code rather than logging on
to the site. Please help.
Here's the code:
Set IE = CreateObject("InternetExplorer.Application")
IE.Navigate "website"
IE.Visible = True
Wscript.Sleep 8000
IE.Document.All.Item("username").Value = "loginname"
IE.Document.All.Item("password").Value = "password"
IE.Document.All.Item("Login").Click
And here's the error:
Script: <nameoffile.vbs>
Line: 7
Char: 1
Error: Object Required: 'IE.Document.All.Item(..)'
Code: 800A01A8
Source: Microsoft VBScript runtime error
Just a guess: the login button is not named "Login". Your seventh line
of code references a control in the All collection by name:
All.Item("Login"). If that is not the name of the button object, it
would return Nothing, and you would get an "Object Required" error when
you tried to invoke its Click method.