View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.programming
Fun Kid Fun Kid is offline
external usenet poster
 
Posts: 13
Default web query w/login and password

Dear Ron,

While trying your method I got an error message.

Run-time error '-2147221248 (80040100)':
Method 'ExecWB' of object 'IWebBrowser2' failed

Also in the previous discussion thread, Jake said I should set me
references to "Microsoft XML, v4.0". I dont have the option to select
v4.0 but I do have v3.0. Even after clicking on that box I got an
error.

Thanks in advance.

"ron" wrote in message
om...
It seems that there are usually several different ways to accomplish
the same goal within Excel. An alternative method to that proposed by
Jake follows:

Sub 401K()

' Prepare to open the web page
Set ie = CreateObject("InternetExplorer.Application")

With ie
.Visible = True
.Navigate "http://www.gwrs.com/"

' Loop until the page is fully loaded
Do Until Not .Busy
DoEvents
Loop

' Make the desired selections on the web page and click the submit
button
Set ipf = ie.document.all.Item("SSN")
ipf.Value = "123456789"
Set ipf = ie.document.all.Item("PIN")
ipf.Value = "abc123"
Set ipf = ie.document.all.Item("btnarrow")
ipf.Value = "submit"
ipf.Click

' Loop until the page is fully loaded
Do Until Not .Busy
DoEvents
Loop

End With

' Select and copy all of the data from the web page
ie.ExecWB OLECMDID_SELECTALL, OLECMDEXECOPT_DONTPROMPTUSER
ie.ExecWB OLECMDID_COPY, OLECMDEXECOPT_DODEFAULT

' Close the internet explorer application
ie.Quit

' Now write code to paste the web page into a worksheet and begin to
' process / extract the information of interest

End Sub

You can usually find the "item names" by viewing the source code for
the web page (right click on the web page and "View Source" is an
option). I can't tell for sure if the above code is error free,
because I don't have a valid PIN. I do know that the above code
correctly enters the SSN and PIN into the login windows and it takes
me to a page that asks for a valid SSN and PIN. So if it doesn't
work, I think it is close...Ron