PC Review


Reply
Thread Tools Rate Thread

code to extract data from a website runs of XP but not Vista

 
 
Russ
Guest
Posts: n/a
 
      9th May 2008
I am working on code to extract data from a website. I am using
CreateObject("InternetExplorer.Application") to start IE. The code is far
from working perfectly but when I moved the code from an XP computer to a
Vista computer I can’t get past the “Do Until .readystate = 4” statement.
IE opens visible and I get the following error message:
“The object invoked has disconnected from its clients”
I did not get this error on the XP computer.

The code is the following:
Sub Tester()
Dim objIE As Object
Dim allTabs, t, x As Integer
Dim r As Long, s As String, c As Long
Set objIE = CreateObject("InternetExplorer.Application")
With objIE
.Visible = False
.Navigate "http://www.masters.org/en_US/scores/index.html"
Do Until .readystate = 4 ‘hangs on this statement on the Vista computer
DoEvents
Loop
With .document
Set allTabs = .getElementsByTagName("TABLE")

For Each t In allTabs
'table with scores is always greater than 30 and only table that
large on page
If t.Rows.Length > 29 Then
r = 2
For x = 1 To t.Rows.Length - 1
For c = 0 To 9
s = t.Rows(x).Cells(c).innerHTML
ActiveWorkbook.Sheets("Info").Cells(r, c + 1).Value
= s
Next c
r = r + 1
Next x
End If
Next t
End With
End With

End Sub

I have a feeling from looking up the error on the web that it may have
something to do with the added security of Vista. Has anyone else run up
against this problem? I see a lot of code samples here that use the same
code to open IE that I do.

--
russ
 
Reply With Quote
 
 
 
 
Russ
Guest
Posts: n/a
 
      16th May 2008
I never received a response to my question but after more web searching I
found the answer.

If anyone stumbles on my question in regard to a similar problem, see this
link for the solution:
www.mjtnet.com/blog/category/vista
The topic is "Web Automation in Vista"
I hope this helps someone.
Russ

--
russ


"Russ" wrote:

> I am working on code to extract data from a website. I am using
> CreateObject("InternetExplorer.Application") to start IE. The code is far
> from working perfectly but when I moved the code from an XP computer to a
> Vista computer I can’t get past the “Do Until .readystate = 4” statement.
> IE opens visible and I get the following error message:
> “The object invoked has disconnected from its clients”
> I did not get this error on the XP computer.
>
> The code is the following:
> Sub Tester()
> Dim objIE As Object
> Dim allTabs, t, x As Integer
> Dim r As Long, s As String, c As Long
> Set objIE = CreateObject("InternetExplorer.Application")
> With objIE
> .Visible = False
> .Navigate "http://www.masters.org/en_US/scores/index.html"
> Do Until .readystate = 4 ‘hangs on this statement on the Vista computer
> DoEvents
> Loop
> With .document
> Set allTabs = .getElementsByTagName("TABLE")
>
> For Each t In allTabs
> 'table with scores is always greater than 30 and only table that
> large on page
> If t.Rows.Length > 29 Then
> r = 2
> For x = 1 To t.Rows.Length - 1
> For c = 0 To 9
> s = t.Rows(x).Cells(c).innerHTML
> ActiveWorkbook.Sheets("Info").Cells(r, c + 1).Value
> = s
> Next c
> r = r + 1
> Next x
> End If
> Next t
> End With
> End With
>
> End Sub
>
> I have a feeling from looking up the error on the web that it may have
> something to do with the added security of Vista. Has anyone else run up
> against this problem? I see a lot of code samples here that use the same
> code to open IE that I do.
>
> --
> russ

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
New Q to old Post: Stuck at Trying to Extract Data from a Website using JSP H Chan Microsoft Excel Programming 2 12th Aug 2009 12:12 PM
Stuck at Trying to Extract Data from a Website using JSP HC Microsoft Excel Programming 16 9th Aug 2009 01:52 PM
code to navigate IE7 runs on XP but not on Vista Ed Vogel Microsoft Excel Programming 2 12th Aug 2008 03:56 PM
How to extract one data from a website Lamb Chop Microsoft Excel Misc 1 20th Jun 2008 02:19 PM
Excel Macro - Extract data from website Icy Microsoft Excel Programming 0 9th Jan 2008 02:39 PM


Features
 

Advertising
 

Newsgroups
 


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