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

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!!
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