View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chris Marlow Chris Marlow is offline
external usenet poster
 
Posts: 74
Default How to retrieve data from web?

Tanilo,

I'd take a slightly different track.

Look up the libraries;
Microsoft WinHTTP Services
Microsoft HTML Object Library

I've posted some code in the last couple of days that utilises these. I
believe it is possible to maintain security permissions accross GET/POST
requests to the server, although I've only done that once & the login was
posting a simple (unencrypted) header.

Regards,

Chris.

--
Chris Marlow
MCSD.NET, Microsoft Office XP Master


" wrote:

Hi all,
I need to do a macro to retrieve data from web and populate a sheet.

After some searches, I found that webquery could be the answer.
So, from Data-Import External Data-New Query, I browse to the page
with interested data, select the table I need and import data. It looks
so easy... but I have a new problem: to access page, first I have to
login into a different page :-(
So... I cannot use the webquery (can I?) :'(

Googling I found some posts with similar problem, where people suggets
to do something like below:

Set ie = CreateObject("InternetExplorer.Application")

With ie
.Visible = True
' Go to DDTS page
.Navigate "http://www.address.com/login"

' Loop until the page is fully loaded
Do Until .ReadyState = 4
DoEvents
Loop

' Make the desired selections on the web page and click the submit
Button
Set ipf = ie.document.all.Item("username")

ipf.Value = "user"
Set ipf = ie.document.all.Item("password")
ipf.Value = "pwd"

Set ipf = ie.document.all.Item(".save")

Set ipf = ie.document.all.Item("login_form")
ipf.Submit

' Loop until the page is fully loaded
Do Until .ReadyState = 4
DoEvents
Loop


..Navigate "http://www.address.com/member/page"
Do Until .ReadyState = 4
DoEvents
Loop


With this code, I can access to the page I need, but now I don't know
how to copy the data I need.

This page has 2 frames, and I need to copy data in a table present in
one of these frames.

Could you please tell me what to do next?

Thanks a lot,
tanilo