View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
[email protected] NoSpam@aol.com is offline
external usenet poster
 
Posts: 142
Default Going to website & Entering username & password

On Thu, 24 Jun 2010 15:29:04 -0700 (PDT), ron wrote:

On Jun 24, 10:02*am, wrote:
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


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!