Going to website & Entering username & password

D

DontEmailMe

From Excel VBA, Can I
go to a website
enter a username & password
proceed to a particular page
download a worksheet

I think if I can get by the 1st two steps I can do the rest.

Thanks for any pointers.
 
R

ron

From Excel VBA, Can I
        go to a website
        enter a username & password
        proceed to a particular page
        download a worksheet

I think if I can get by the 1st two steps I can do the rest.

Thanks for any pointers.

First you'll need to look at the source code behind the login page and
see what terms they use for the username and password and then
substitute them into the code below, along with your actual username
and pw. Figuring ot how to click the submit button is also dependent
on the source code. If you could post the url, maybe I could be more
specific. In any case, insert the code below into a module and that
should get you started...Ron

Set ie = CreateObject("InternetExplorer.Application")

With ie
.Visible = True
.Navigate "https://your website.com"
.Top = 50
.Left = 530
.Height = 400
.Width = 400

' Loop until the page is fully loaded
Do Until Not ie.Busy And ie.ReadyState = 4
DoEvents
Loop

' Make the desired selections on the Login web page and click the
submit button
Set ipf = ie.document.login_form.Item("usr_name")
ipf.Value = "your username or ID"

Set ipf = ie.document.login_form.Item("usr_password")
ipf.Value = "your pw"

ie.document.all.Item("login_form").submit

' Loop until the page is fully loaded
Do Until Not ie.Busy And ie.ReadyState = 4
DoEvents
Loop

' Now do whatever
 
D

DontEmailMe

Thank you. I have not trtied it but it is quite readable. There may be
more to it. Could you point me to a tutorial on interacting with web pages
or some other source of info?

Thanks again!!
 
G

Guest

First you'll need to look at the source code behind the login page and
see what terms they use for the username and password and then
substitute them into the code below, along with your actual username
and pw. Figuring ot how to click the submit button is also dependent
on the source code. If you could post the url, maybe I could be more
specific. In any case, insert the code below into a module and that
should get you started...Ron

Set ie = CreateObject("InternetExplorer.Application")

With ie
.Visible = True
.Navigate "https://your website.com"
.Top = 50
.Left = 530
.Height = 400
.Width = 400

' Loop until the page is fully loaded
Do Until Not ie.Busy And ie.ReadyState = 4
DoEvents
Loop

' Make the desired selections on the Login web page and click the
submit button
Set ipf = ie.document.login_form.Item("usr_name")
ipf.Value = "your username or ID"

Set ipf = ie.document.login_form.Item("usr_password")
ipf.Value = "your pw"

ie.document.all.Item("login_form").submit

' Loop until the page is fully loaded
Do Until Not ie.Busy And ie.ReadyState = 4
DoEvents
Loop

' Now do whatever

Thanks again. With your help, I am able to get logged in. I was trying to
figure out how to go to the page I need & downolad a file when I learned
that they are replacing the website in July with something totally new so
I'll wait until then to work any more on it.

I would still like to know if any tutorial is available.

Thanks!
 

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