Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 142
Default Trying Excel VBA to get data into a worksheet using Internet Explorer

I am trying to read data from a website using the navigate method. The
website returns 40 data items of interest out of a total of 18,000 so I
have to read many times to get all 18,000 items.

The problem is that sometimes the data returned by Execel is incomplete
(only part of the html is returned). The problem does not appear to be the
website because only this happens when using Excel. Repeating the
identical attempt to read the data from the web will almost always give the
correct results. Rarely, I'll have to make 3 attempts to get it right.
Here is the code I am using:

Dim oie As Object
Dim i as Long
Dim Done as Boolean

Set oie = CreateObject("InternetExplorer.Application")
Done = False
i = 2
While Not Done
oie.Navigate "http://www.WebSiteOfInterest.com/" & ThisTimesReq(i)
oie.Visible = False
Do
Loop Until oie.ReadyState = 4
Range("A" & i) = oie.Document.body.outerhtml
If instr(Range("A" & i), "Data past what I'm looking for") = 0 then
i =i - 1
End If
i = i + 1
If SomeTestSaysWeAreDone then Done = True
Wend

The code above works only because , after each read, I look for html that
comes after all of the stuff I am interested in. If it is missing, I know
the read was incomplete and all of the info I need may not be there. By
setting i=i-1 another attempt is made to read the same data.

I am using Windows XP-Pro with all updates and Excel 2003 SP 2

QUESTIONS:
1. Is there something wrong with my code?
2. If not, is this a common Excel problem?
3. Is there another way to do this that is reliable so I don't have to
repeat failed attempts?

Many thanks for any help/
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I view Excel data in Internet Explorer? Wolfman566 Excel Discussion (Misc queries) 1 May 2nd 09 11:16 AM
get data from an Internet Explorer Table lvcha.gouqizi Excel Programming 0 January 10th 06 03:13 PM
Exporting data from Excel into Internet Explorer green78[_3_] Excel Programming 1 March 3rd 04 12:59 PM
Move Data Between Excel and Internet Explorer gg Excel Programming 1 December 4th 03 08:34 PM
VBA update data from Internet Explorer and copy to Excel? Mauricio Harger Excel Programming 1 August 18th 03 09:26 PM


All times are GMT +1. The time now is 02:22 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"