PDA

View Full Version : Get Data from IE Error ....



KK1966
04-28-2013, 07:12 PM
Hi, All
Since i change windows 7 then the code was can't work !! does it the mail issue computer version or the IE 9 problem ?

Dim lnk As Object, ie As Object, doc As Object, i As Long, lr As Long, r As Long, X As Long
Dim Start As Single
Dim TimeRange As Variant
Dim Sr, Irow As Long
Const Pause = 900
If Cells(1, 1) = "STA Run Start" Then
Else
Exit Sub
End If
Do While True
Sheets("Web Data").Visible = True
Sheets("Web Data").Select
Cells.Select
Selection.ClearContents
IndexI = 2
For i = 1 To 3
URLLINK = Sheet1.Cells(i, 1)
Set ie = CreateObject("InternetExplorer.Application")
With ie
URL = URLLINK
.Visible = False
.Navigate URLLINK
Do Until .ReadyState = 4: DoEvents: Loop
Set doc = ie.document
.ExecWB 17, 0
.ExecWB 12, 2
.Quit
End With
Set ie = Nothing

Kenneth Hobs
04-29-2013, 09:35 AM
I don't know what doesn't work. When working a problem, it is best to have a short snippet of complete code to test.

There are MSIE object methods and other methods that can get parts of a web page. It just depends on your needs.

From a blank sheet, try this:
Sub TestIE_Import()
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")
With IE
.Visible = True
.Navigate "http://msn.com"
Do Until .ReadyState = 4: DoEvents: Loop
.ExecWB 17, 0 '// SelectAll
.ExecWB 12, 2 '// Copy selection
ActiveSheet.PasteSpecial Format:="Text", link:=False, DisplayAsIcon:=False
'Range("A1").PasteSpecial
.Quit
End With
End Sub